Skip to content
Snippets Groups Projects
Commit 20461ec0 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

TST: added test for unreadable files

parent afc902e0
No related branches found
No related tags found
1 merge request!22Release 0.3
......@@ -22,6 +22,7 @@ from tempfile import NamedTemporaryFile
import numpy as np
import pandas as pd
from caosadvancedtools.datainconsistency import DataInconsistencyError
from caosadvancedtools.table_importer import (XLS_Importer, name_converter,
yes_no_converter)
......@@ -70,6 +71,7 @@ class XLS_ImporterTest(unittest.TestCase):
self.assertEqual(df_new.iloc[0].b, 5)
def test_full(self):
""" test full run with example data """
tmp = NamedTemporaryFile(delete=False, suffix=".xlsx")
tmp.close()
self.valid_df.to_excel(tmp.name)
......@@ -81,3 +83,9 @@ class XLS_ImporterTest(unittest.TestCase):
columns=['a', 'b', 'c', 'd'])
df_new = self.importer.check_unique(df)
self.assertEqual(df_new.shape[0], 1)
def test_raise(self):
tmp = NamedTemporaryFile(delete=False, suffix=".lol")
tmp.close()
self.assertRaises(DataInconsistencyError, self.importer.read_xls,
tmp.name)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment