update tests and add long description to setup
This commit is contained in:
parent
a140a5d4b9
commit
f6ed9d088f
|
|
@ -1,43 +1,39 @@
|
|||
import os
|
||||
import sys
|
||||
|
||||
import pandas as pd
|
||||
|
||||
from pandas_ods_reader import read_ods
|
||||
|
||||
|
||||
root = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
|
||||
def test_header_file():
|
||||
example = "example_headers.ods"
|
||||
path = os.path.join(root, example)
|
||||
print("Test sheet by index")
|
||||
df = read_ods(path, 1)
|
||||
print(df)
|
||||
print("Test sheet by name")
|
||||
df = read_ods(path, "Sheet1")
|
||||
print(df)
|
||||
class OdsReaderTest(object):
|
||||
def test_header_file_with_int():
|
||||
example = "example_headers.ods"
|
||||
path = os.path.join(root, example)
|
||||
# print("Test sheet by index")
|
||||
df = read_ods(path, 1)
|
||||
assert isinstance(df, pd.DataFrame)
|
||||
|
||||
def test_header_file_with_str():
|
||||
example = "example_headers.ods"
|
||||
path = os.path.join(root, example)
|
||||
df = read_ods(path, "Sheet1")
|
||||
print(df)
|
||||
assert isinstance(df, pd.DataFrame)
|
||||
|
||||
def test_no_header_file():
|
||||
example = "example_no_headers.ods"
|
||||
path = os.path.join(root, example)
|
||||
print("Test sheet by index and default columns")
|
||||
df = read_ods(path, 1, headers=False)
|
||||
print(df)
|
||||
print("Test sheet by name and default columns")
|
||||
df = read_ods(path, "Sheet1", headers=False)
|
||||
print(df)
|
||||
print("Test sheet by index and specific columns")
|
||||
columns = ["A", "B", "C", "D", "E"]
|
||||
df = read_ods(path, 1, headers=False, columns=columns)
|
||||
print(df)
|
||||
|
||||
|
||||
def main():
|
||||
test_header_file()
|
||||
test_no_header_file()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
status = main()
|
||||
sys.exit(status)
|
||||
def test_no_header_file():
|
||||
example = "example_no_headers.ods"
|
||||
path = os.path.join(root, example)
|
||||
print("Test sheet by index and default columns")
|
||||
df = read_ods(path, 1, headers=False)
|
||||
print(df)
|
||||
print("Test sheet by name and default columns")
|
||||
df = read_ods(path, "Sheet1", headers=False)
|
||||
print(df)
|
||||
print("Test sheet by index and specific columns")
|
||||
columns = ["A", "B", "C", "D", "E"]
|
||||
df = read_ods(path, 1, headers=False, columns=columns)
|
||||
print(df)
|
||||
|
|
|
|||
7
setup.py
7
setup.py
|
|
@ -1,11 +1,16 @@
|
|||
from setuptools import setup, find_packages
|
||||
|
||||
|
||||
VERSION = "0.0.3"
|
||||
VERSION = "0.0.4"
|
||||
|
||||
with open("README.md", "r") as fh:
|
||||
long_description = fh.read()
|
||||
|
||||
setup(name="pandas_ods_reader",
|
||||
version=VERSION,
|
||||
description="Read in an ODS file and return it as a pandas.DataFrame",
|
||||
long_description=long_description,
|
||||
long_description_content_type="text/markdown",
|
||||
classifiers=[
|
||||
'Development Status :: 3 - Alpha',
|
||||
'License :: OSI Approved :: MIT License',
|
||||
|
|
|
|||
Loading…
Reference in New Issue