@@ -367,6 +367,7 @@ def test_sort():
367367def test_sort():
368368 codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
369369 input = [5, 4, 3, 2, 1, 0]
370+ print(datetime.datetime.now().isoformat())
370371 output = codeflash_wrap(sorter, '{module_path}', None, 'test_sort', 'sorter', '2', codeflash_loop_index, input)
371372 assert output == [0, 1, 2, 3, 4, 5]
372373 input = [5.0, 4.0, 3.0, 2.0, 1.0, 0.0]
@@ -395,7 +396,7 @@ def test_sort():
395396 os .chdir (run_cwd )
396397 success , new_test = inject_profiling_into_existing_test (
397398 test_path ,
398- [CodePosition (8 , 13 ), CodePosition (12 , 13 )],
399+ [CodePosition (8 , 14 ), CodePosition (12 , 14 )],
399400 func ,
400401 project_root_path ,
401402 "pytest" ,
@@ -411,7 +412,7 @@ def test_sort():
411412
412413 success , new_perf_test = inject_profiling_into_existing_test (
413414 test_path ,
414- [CodePosition (6 , 13 ), CodePosition (10 , 13 )],
415+ [CodePosition (8 , 14 ), CodePosition (12 , 14 )],
415416 func ,
416417 project_root_path ,
417418 "pytest" ,
@@ -461,7 +462,7 @@ def test_sort():
461462 testing_time = 0.1 ,
462463 )
463464 assert test_results [0 ].id .function_getting_tested == "sorter"
464- assert test_results [0 ].id .iteration_id == "1_0 "
465+ assert test_results [0 ].id .iteration_id == "2_0 "
465466 assert test_results [0 ].id .test_class_name is None
466467 assert test_results [0 ].id .test_function_name == "test_sort"
467468 assert (
@@ -473,7 +474,7 @@ def test_sort():
473474 assert test_results [0 ].return_value == ([0 , 1 , 2 , 3 , 4 , 5 ],)
474475
475476 assert test_results [1 ].id .function_getting_tested == "sorter"
476- assert test_results [1 ].id .iteration_id == "4_0 "
477+ assert test_results [1 ].id .iteration_id == "5_0 "
477478 assert test_results [1 ].id .test_class_name is None
478479 assert test_results [1 ].id .test_function_name == "test_sort"
479480 assert (
@@ -496,7 +497,7 @@ def test_sort():
496497 testing_time = 0.1 ,
497498 )
498499 assert test_results_perf [0 ].id .function_getting_tested == "sorter"
499- assert test_results_perf [0 ].id .iteration_id == "1_0 "
500+ assert test_results_perf [0 ].id .iteration_id == "2_0 "
500501 assert test_results_perf [0 ].id .test_class_name is None
501502 assert test_results_perf [0 ].id .test_function_name == "test_sort"
502503 assert (
@@ -514,7 +515,7 @@ def test_sort():
514515 )
515516
516517 assert test_results_perf [1 ].id .function_getting_tested == "sorter"
517- assert test_results_perf [1 ].id .iteration_id == "4_0 "
518+ assert test_results_perf [1 ].id .iteration_id == "5_0 "
518519 assert test_results_perf [1 ].id .test_class_name is None
519520 assert test_results_perf [1 ].id .test_function_name == "test_sort"
520521 assert (
@@ -565,7 +566,6 @@ def test_perfinjector_bubble_sort_parametrized_results() -> None:
565566 computed_fn_opt = False
566567 code = """from code_to_optimize.bubble_sort import sorter
567568import pytest
568- import datetime
569569
570570
571571@pytest.mark.parametrize(
@@ -577,7 +577,6 @@ def test_perfinjector_bubble_sort_parametrized_results() -> None:
577577 ],
578578)
579579def test_sort_parametrized(input, expected_output):
580- print(datetime.datetime.now().isoformat())
581580 output = sorter(input)
582581 assert output == expected_output
583582"""
@@ -613,7 +612,6 @@ def test_sort_parametrized(input, expected_output):
613612 """import gc
614613import os
615614import time
616- import datetime
617615
618616import pytest
619617
@@ -626,7 +624,6 @@ def test_sort_parametrized(input, expected_output):
626624@pytest.mark.parametrize('input, expected_output', [([5, 4, 3, 2, 1, 0], [0, 1, 2, 3, 4, 5]), ([5.0, 4.0, 3.0, 2.0, 1.0, 0.0], [0.0, 1.0, 2.0, 3.0, 4.0, 5.0]), (list(reversed(range(50))), list(range(50)))])
627625def test_sort_parametrized(input, expected_output):
628626 codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
629- print(datetime.datetime.now().isoformat())
630627 output = codeflash_wrap(sorter, '{module_path}', None, 'test_sort_parametrized', 'sorter', '0', codeflash_loop_index, input)
631628 assert output == expected_output
632629"""
@@ -652,11 +649,11 @@ def test_sort_parametrized(input, expected_output):
652649 func = FunctionToOptimize (function_name = "sorter" , parents = [], file_path = code_path )
653650 os .chdir (run_cwd )
654651 success , new_test = inject_profiling_into_existing_test (
655- test_path , [CodePosition (16 , 13 )], func , project_root_path , "pytest" , mode = TestingMode .BEHAVIOR
652+ test_path , [CodePosition (14 , 13 )], func , project_root_path , "pytest" , mode = TestingMode .BEHAVIOR
656653 )
657654 assert success
658655 success , new_test_perf = inject_profiling_into_existing_test (
659- test_path , [CodePosition (16 , 13 )], func , project_root_path , "pytest" , mode = TestingMode .PERFORMANCE
656+ test_path , [CodePosition (14 , 13 )], func , project_root_path , "pytest" , mode = TestingMode .PERFORMANCE
660657 )
661658
662659 os .chdir (original_cwd )
0 commit comments