diff --git a/unittests/test_table_importer.py b/unittests/test_table_importer.py index 6681ed2cd0d79bda9e0e03de7f24c3cb50557395..46427c1612591227c5c2f8d991f6422dc4496de1 100644 --- a/unittests/test_table_importer.py +++ b/unittests/test_table_importer.py @@ -77,7 +77,8 @@ class ConverterTest(unittest.TestCase): # TODO datatypes are different; fix it assert df.d.iloc[0] == datetime.datetime(1980, 12, 31, 13, 24, 23) - def test_date(self): + def test_date_xlsx(self): + """Test with .xlsx in order to check openpyxl engine.""" test_file = os.path.join(os.path.dirname(__file__), "date.xlsx") self.importer = XLSImporter(converters={'a': date_converter, 'b': date_converter, @@ -91,6 +92,21 @@ class ConverterTest(unittest.TestCase): assert df.shape[0] == 2 assert df.a.iloc[0] == df.b.iloc[0] == df.c.iloc[0] + def test_date_xls(self): + """Test with .xlsx in order to check xlrd engine.""" + test_file = os.path.join(os.path.dirname(__file__), "date.xls") + self.importer = XLSImporter(converters={'a': date_converter, + 'b': date_converter, + 'c': partial(date_converter, + fmt="%d.%m.%y") + }, obligatory_columns=['a']) + + xls_file = pd.io.excel.ExcelFile(test_file) + df = xls_file.parse() + df = self.importer.read_xls(test_file) + assert df.shape[0] == 2 + assert df.a.iloc[0] == df.b.iloc[0] == df.c.iloc[0] + def test_inc_date(self): incomplete_date_converter("2020", fmts={"%Y": "%Y"}) == "2020" incomplete_date_converter("02/2020",