diff --git a/CHANGELOG.md b/CHANGELOG.md index 47c27848c5ff7873d178a47c08fdb852fd5f2fd2..799d4ba1758fb4735c35a7a7923e99fd767ee76b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -68,6 +68,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * #40 Insertion of identifiables with missing obligatory properties - Before, a Property with the datatype "LIST(TEXT)" would lead to the creation of a RecordType. This is fixed now. +* #52 `XLSimporter.read_xls` throwed a wrong error when reading from a file with a wrong ending. + Now, a `DataInconsistencyError` is raised instead of a ValueError. ### Security ### diff --git a/src/caosadvancedtools/table_importer.py b/src/caosadvancedtools/table_importer.py index 89d404deb047f96c0fa017cc0dfef391cf9f8868..54fb61bb05da0aeebf5a1da5ff46a9443e59112d 100755 --- a/src/caosadvancedtools/table_importer.py +++ b/src/caosadvancedtools/table_importer.py @@ -195,7 +195,7 @@ class XLSImporter(object): """ try: xls_file = pd.io.excel.ExcelFile(filename) - except XLRDError as e: + except (XLRDError, ValueError) as e: logger.warning( "Cannot read \n{}.\nError:{}".format(filename, str(e)), diff --git a/unittests/test_table_importer.py b/unittests/test_table_importer.py index a9672b83a8b76eb87b001c304036c9a207fdbd5b..671fcec61569f4802aa5db78a6b2283f54fb24f5 100644 --- a/unittests/test_table_importer.py +++ b/unittests/test_table_importer.py @@ -174,7 +174,6 @@ class XLSImporterTest(unittest.TestCase): df_new = self.importer.check_unique(df) self.assertEqual(df_new.shape[0], 1) - @pytest.mark.xfail(reason="Wrong Error is raised. See Issue #52") def test_raise(self): tmp = NamedTemporaryFile(delete=False, suffix=".lol") tmp.close()