|
14 | 14 |
|
15 | 15 | INCREASED_RECURSION_LIMIT = 5000 |
16 | 16 |
|
| 17 | +reprlib_repr = reprlib.Repr(maxstring=1500) |
| 18 | +test_diff_repr = reprlib_repr.repr |
| 19 | + |
17 | 20 |
|
18 | 21 | def compare_test_results(original_results: TestResults, candidate_results: TestResults) -> tuple[bool, list[TestDiff]]: |
19 | 22 | # This is meant to be only called with test results for the first loop index |
@@ -68,27 +71,13 @@ def compare_test_results(original_results: TestResults, candidate_results: TestR |
68 | 71 | ) |
69 | 72 | if original_pytest_error: |
70 | 73 | original_pytest_error = shorten_pytest_error(original_pytest_error) |
71 | | - test_src_code = original_test_result.id.get_src_code(original_test_result.file_name) |
72 | | - test_diff = TestDiff( |
73 | | - scope=TestDiffScope.RETURN_VALUE, |
74 | | - original_value=reprlib.repr(original_test_result.return_value), |
75 | | - candidate_value=reprlib.repr(cdd_test_result.return_value), |
76 | | - test_src_code=test_src_code, |
77 | | - candidate_pytest_error=cdd_pytest_error, |
78 | | - original_pass=original_test_result.did_pass, |
79 | | - candidate_pass=cdd_test_result.did_pass, |
80 | | - original_pytest_error=original_pytest_error, |
81 | | - ) |
82 | | - if not comparator(original_test_result.return_value, cdd_test_result.return_value, superset_obj=superset_obj): |
83 | | - test_diff.scope = TestDiffScope.RETURN_VALUE |
84 | | - test_diffs.append(test_diff) |
85 | 74 |
|
86 | 75 | if not comparator(original_test_result.return_value, cdd_test_result.return_value, superset_obj=superset_obj): |
87 | 76 | test_diffs.append( |
88 | 77 | TestDiff( |
89 | 78 | scope=TestDiffScope.RETURN_VALUE, |
90 | | - original_value=repr(original_test_result.return_value), |
91 | | - candidate_value=repr(cdd_test_result.return_value), |
| 79 | + original_value=test_diff_repr(repr(original_test_result.return_value)), |
| 80 | + candidate_value=test_diff_repr(repr(cdd_test_result.return_value)), |
92 | 81 | test_src_code=original_test_result.id.get_src_code(original_test_result.file_name), |
93 | 82 | candidate_pytest_error=cdd_pytest_error, |
94 | 83 | original_pass=original_test_result.did_pass, |
|
0 commit comments