Extract addition of assertions into a separate method, so that we don't abort assertion generation prematurely, when one test case exceeds its size.
@@ -81,15 +81,17 @@ class AssertionGenerator(cv.ChromosomeVisitor):
self, tests_and_results: List[Tuple[tc.TestCase, List[ex.ExecutionResult]]]
):
for test_case, results in tests_and_results:
+ self._add_assertions_for(test_case, results)
+
+ def _add_assertions_for(
+ self, test_case: tc.TestCase, results: List[ex.ExecutionResult]
+ ):
# In order to avoid repeating the same assertions after each statement,
# we keep track of the last assertions and only assert things, if they
# have changed.
previous_statement_assertions = OrderedSet()
-
for statement in test_case.statements:
- current_statement_assertions = self._get_assertions_for(
- results, statement
- )
+ current_statement_assertions = self._get_assertions_for(results, statement)
for assertion in current_statement_assertions:
if assertion in previous_statement_assertions:
# We already saw the same assertion in the previous statement
