|
8 | 8 | import subprocess |
9 | 9 | import time |
10 | 10 | import uuid |
11 | | -from collections import Counter, defaultdict |
| 11 | +from collections import defaultdict |
12 | 12 | from pathlib import Path |
13 | 13 | from typing import TYPE_CHECKING |
14 | 14 |
|
@@ -1401,13 +1401,9 @@ def process_review( |
1401 | 1401 | generated_tests = remove_functions_from_generated_tests( |
1402 | 1402 | generated_tests=generated_tests, test_functions_to_remove=test_functions_to_remove |
1403 | 1403 | ) |
1404 | | - map_gen_test_file_to_no_of_tests = Counter() |
1405 | | - for gen_test_result in original_code_baseline.behavior_test_results: |
1406 | | - if ( |
1407 | | - "__unit_test_" in str(gen_test_result.file_name) |
1408 | | - and gen_test_result.id.test_function_name not in test_functions_to_remove |
1409 | | - ): |
1410 | | - map_gen_test_file_to_no_of_tests[gen_test_result.file_name] += 1 |
| 1404 | + map_gen_test_file_to_no_of_tests = original_code_baseline.behavior_test_results.file_to_no_of_tests( |
| 1405 | + test_functions_to_remove |
| 1406 | + ) |
1411 | 1407 |
|
1412 | 1408 | original_runtime_by_test = original_code_baseline.benchmarking_test_results.usable_runtime_data_by_test_case() |
1413 | 1409 | optimized_runtime_by_test = ( |
@@ -1573,7 +1569,8 @@ def establish_original_code_baseline( |
1573 | 1569 | ) -> Result[tuple[OriginalCodeBaseline, list[str]], str]: |
1574 | 1570 | line_profile_results = {"timings": {}, "unit": 0, "str_out": ""} |
1575 | 1571 | # For the original function - run the tests and get the runtime, plus coverage |
1576 | | - assert (test_framework := self.args.test_framework) in {"pytest", "unittest"} # noqa: RUF018 |
| 1572 | + test_framework = self.args.test_framework |
| 1573 | + assert test_framework in {"pytest", "unittest"} |
1577 | 1574 | success = True |
1578 | 1575 |
|
1579 | 1576 | test_env = self.get_test_env(codeflash_loop_index=0, codeflash_test_iteration=0, codeflash_tracer_disable=1) |
@@ -1751,7 +1748,8 @@ def run_optimized_candidate( |
1751 | 1748 | original_helper_code: dict[Path, str], |
1752 | 1749 | file_path_to_helper_classes: dict[Path, set[str]], |
1753 | 1750 | ) -> Result[OptimizedCandidateResult, str]: |
1754 | | - assert (test_framework := self.args.test_framework) in {"pytest", "unittest"} # noqa: RUF018 |
| 1751 | + test_framework = self.args.test_framework |
| 1752 | + assert test_framework in {"pytest", "unittest"} |
1755 | 1753 |
|
1756 | 1754 | with progress_bar("Testing optimization candidate"): |
1757 | 1755 | test_env = self.get_test_env( |
|
0 commit comments