MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / compare_results

Function compare_results

tests/packagedcode/test_maven.py:59–75  ·  view source on GitHub ↗
(results, test_pom_loc, expected_json_loc, regen=REGEN_TEST_FIXTURES)

Source from the content-addressed store, hash-verified

57
58
59def compare_results(results, test_pom_loc, expected_json_loc, regen=REGEN_TEST_FIXTURES):
60 if regen:
61 with open(expected_json_loc, 'w') as ex:
62 json.dump(results, ex, indent=2)
63
64 with io.open(expected_json_loc, encoding='utf-8') as ex:
65 expected = json.load(ex)
66
67 results_dump = json.dumps(results, indent=2)
68 expected_dump = json.dumps(expected, indent=2)
69 try:
70 assert results == expected
71 except AssertionError:
72 test_pom_loc = 'file://' + test_pom_loc
73 expected_json_loc = 'file://' + expected_json_loc
74 expected = [test_pom_loc, expected_json_loc, expected_dump]
75 assert results_dump == '\n'.join(expected)
76
77
78def parse_pom(location=None):

Callers 2

check_parse_pomMethod · 0.85

Calls 5

dumpMethod · 0.45
openMethod · 0.45
loadMethod · 0.45
dumpsMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected