Skip to content
Snippets Groups Projects
Verified Commit c14fcef2 authored by Daniel Hornung's avatar Daniel Hornung
Browse files

STY: Whitespaces and test.

parent 45384af9
Branches
Tags
2 merge requests!112Release 0.12.0,!111F better csv value error
Pipeline #53503 passed
...@@ -574,7 +574,7 @@ class CSVImporter(TableImporter): ...@@ -574,7 +574,7 @@ class CSVImporter(TableImporter):
for ii, error_list in error_dict.items(): for ii, error_list in error_dict.items():
msg += f"* row {ii}:\n" msg += f"* row {ii}:\n"
for err in error_list: for err in error_list:
msg += f"\t* column \"{err[0]}\": Expected \"{err[1]}\" but found \"{err[2]}\".\n" msg += f" * column \"{err[0]}\": Expected \"{err[1]}\" but found \"{err[2]}\".\n"
msg += '\n' msg += '\n'
raise DataInconsistencyError(msg) raise DataInconsistencyError(msg)
......
...@@ -408,6 +408,7 @@ class CSVImporterTest(TableImporterTest): ...@@ -408,6 +408,7 @@ class CSVImporterTest(TableImporterTest):
with pytest.raises(DataInconsistencyError) as die: with pytest.raises(DataInconsistencyError) as die:
df = importer.read_file(tmpfile.name) df = importer.read_file(tmpfile.name)
msg = str(die.value) msg = str(die.value)
print("\n" + msg)
assert "Elements with wrong datatypes encountered:\n" in msg assert "Elements with wrong datatypes encountered:\n" in msg
# Errors in rows 1 and 3, no errors in 2 and 4 # Errors in rows 1 and 3, no errors in 2 and 4
assert "* row 1:\n" in msg assert "* row 1:\n" in msg
...@@ -418,9 +419,9 @@ class CSVImporterTest(TableImporterTest): ...@@ -418,9 +419,9 @@ class CSVImporterTest(TableImporterTest):
# exactly 2 errors in row 1, exactly 1 in row 3 # exactly 2 errors in row 1, exactly 1 in row 3
assert len(row_1_msgs.strip().split('\n')) == 2 assert len(row_1_msgs.strip().split('\n')) == 2
assert len(row_3_msgs.strip().split('\n')) == 1 assert len(row_3_msgs.strip().split('\n')) == 1
assert "\t* column \"int\"" in row_1_msgs assert " * column \"int\"" in row_1_msgs
assert "\t* column \"float\"" in row_1_msgs assert " * column \"float\"" in row_1_msgs
assert "\t* column \"float\"" in row_3_msgs assert " * column \"float\"" in row_3_msgs
class TSVImporterTest(TableImporterTest): class TSVImporterTest(TableImporterTest):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment