Skip to content
Snippets Groups Projects
Commit d7538c91 authored by Florian Obersteiner's avatar Florian Obersteiner
Browse files

do not ignore arbitrary Exceptions

parent fcdf7fe4
Branches
Tags
1 merge request!5introduction of pathlib.Path
This commit is part of merge request !5. Comments created here will be created in the context of that merge request.
......@@ -35,33 +35,33 @@ def compareFiles(fn, strIn, strOut, skiplines=0, nlines=-1): # pragma: no cover
valid_data_line = False
# maybe this is a data line in which we only have different number formatting?
# compare as floats
try:
insteps = [float(x) for x in inline.split(",")]
outsteps = [float(x) for x in outline.split(",")]
if len(insteps) == len(outsteps):
valid_data_line = True
for i in range(len(insteps)):
valid_data_line = valid_data_line and insteps[i] == outsteps[i]
except:
pass
# try:
insteps = [float(x) for x in inline.split(",")]
outsteps = [float(x) for x in outline.split(",")]
if len(insteps) == len(outsteps):
valid_data_line = True
for i in range(len(insteps)):
valid_data_line = valid_data_line and insteps[i] == outsteps[i]
# except:
# pass
valid_var_line = False
try:
insteps = [x.strip() for x in inline.split(",")]
outsteps = [x.strip() for x in outline.split(",")]
if len(insteps) == 2 and len(outsteps) == 3:
valid_var_line = (
insteps[0] == outsteps[0]
and insteps[1] == outsteps[1]
and insteps[1] == outsteps[2]
)
except:
pass
# try:
insteps = [x.strip() for x in inline.split(",")]
outsteps = [x.strip() for x in outline.split(",")]
if len(insteps) == 2 and len(outsteps) == 3:
valid_var_line = (
insteps[0] == outsteps[0]
and insteps[1] == outsteps[1]
and insteps[1] == outsteps[2]
)
# except:
# pass
if not valid_data_line and not valid_var_line:
print("{:s}: line {:d} differs:".format(fn, i))
print(" input: {:s}".format(inline))
print(" output: {:s}".format(outline))
print(f"{str(fn)}: line {i:d} differs:")
print(f" input: {inline}")
print(f" output: {outline}")
return False
......@@ -352,4 +352,4 @@ class BulkIOTestCase(unittest.TestCase):
if __name__ == "__main__": # pragma: no cover
unittest.main()
unittest.main()
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment