diff options
author | Frederick Muriuki Muriithi | 2023-01-25 02:17:50 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2023-01-25 02:17:50 +0300 |
commit | 3f0641214946d7042a24397eb3862743dbcd58c1 (patch) | |
tree | 4a316e2e869f14850a7d243fd2299dea95dce910 /test | |
parent | 5b064a2958e1e2494e9af7defaedae0a33760ac7 (diff) | |
download | genenetwork2-3f0641214946d7042a24397eb3862743dbcd58c1.tar.gz |
mechanical-rob: Fix bugs with corrs test
* Replace CRLF in html output with newline to prevent equality
comparisons from failing if that's the only difference.
* Only include failures that have actual content: filter out empty
failure items
* Print out an extra newline on completion of checks
Diffstat (limited to 'test')
-rw-r--r-- | test/requests/correlation_tests.py | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/test/requests/correlation_tests.py b/test/requests/correlation_tests.py index ac1565e6..8c7fc29f 100644 --- a/test/requests/correlation_tests.py +++ b/test/requests/correlation_tests.py @@ -145,7 +145,8 @@ def parse_results_from_html(raw_html): str(row["trait_id"]): row for row in json.loads(thread( script_content, - lambda val: val[len("var tableJson = "):].strip()))} + lambda val: val[len("var tableJson = "):].strip().replace( + "\\r\\n", "\\n")))} return {} @@ -178,10 +179,12 @@ def collect_failures(actual, expected, keys): return __eq return tuple( - __equal(str(exp_row["Record"]), - actual.get(str(exp_row["Record"])), - exp_row) - for exp_row in expected) + item for item in ( + __equal(str(exp_row["Record"]), + actual.get(str(exp_row["Record"])), + exp_row) + for exp_row in expected) + if bool(item)) def check_correctness(host): # pearsons_keys = ( @@ -247,9 +250,11 @@ def check_correctness(host): filepath = Path.cwd().parent.joinpath( f"test/requests/correlation_results_text_files/{expected_file}") failures = { - **failures, - test_title: collect_failures( - results, tuple(parse_expected(filepath)), method_keys) + key: value for key,value in { + **failures, + test_title: collect_failures( + results, tuple(parse_expected(filepath)), method_keys) + }.items() if len(value) > 0 } if len(failures) > 0: @@ -262,6 +267,7 @@ def check_correctness(host): print_newline = True if len(result_failures) > 0: print("") + print("") return False return True |