@@ -367,6 +367,7 @@ def test_sort():
367
367
def test_sort():
368
368
codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
369
369
input = [5, 4, 3, 2, 1, 0]
370
+ print(datetime.datetime.now().isoformat())
370
371
output = codeflash_wrap(sorter, '{module_path}', None, 'test_sort', 'sorter', '2', codeflash_loop_index, input)
371
372
assert output == [0, 1, 2, 3, 4, 5]
372
373
input = [5.0, 4.0, 3.0, 2.0, 1.0, 0.0]
@@ -395,7 +396,7 @@ def test_sort():
395
396
os .chdir (run_cwd )
396
397
success , new_test = inject_profiling_into_existing_test (
397
398
test_path ,
398
- [CodePosition (8 , 13 ), CodePosition (12 , 13 )],
399
+ [CodePosition (8 , 14 ), CodePosition (12 , 14 )],
399
400
func ,
400
401
project_root_path ,
401
402
"pytest" ,
@@ -411,7 +412,7 @@ def test_sort():
411
412
412
413
success , new_perf_test = inject_profiling_into_existing_test (
413
414
test_path ,
414
- [CodePosition (6 , 13 ), CodePosition (10 , 13 )],
415
+ [CodePosition (8 , 14 ), CodePosition (12 , 14 )],
415
416
func ,
416
417
project_root_path ,
417
418
"pytest" ,
@@ -461,7 +462,7 @@ def test_sort():
461
462
testing_time = 0.1 ,
462
463
)
463
464
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 "
465
466
assert test_results [0 ].id .test_class_name is None
466
467
assert test_results [0 ].id .test_function_name == "test_sort"
467
468
assert (
@@ -473,7 +474,7 @@ def test_sort():
473
474
assert test_results [0 ].return_value == ([0 , 1 , 2 , 3 , 4 , 5 ],)
474
475
475
476
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 "
477
478
assert test_results [1 ].id .test_class_name is None
478
479
assert test_results [1 ].id .test_function_name == "test_sort"
479
480
assert (
@@ -496,7 +497,7 @@ def test_sort():
496
497
testing_time = 0.1 ,
497
498
)
498
499
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 "
500
501
assert test_results_perf [0 ].id .test_class_name is None
501
502
assert test_results_perf [0 ].id .test_function_name == "test_sort"
502
503
assert (
@@ -514,7 +515,7 @@ def test_sort():
514
515
)
515
516
516
517
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 "
518
519
assert test_results_perf [1 ].id .test_class_name is None
519
520
assert test_results_perf [1 ].id .test_function_name == "test_sort"
520
521
assert (
@@ -565,7 +566,6 @@ def test_perfinjector_bubble_sort_parametrized_results() -> None:
565
566
computed_fn_opt = False
566
567
code = """from code_to_optimize.bubble_sort import sorter
567
568
import pytest
568
- import datetime
569
569
570
570
571
571
@pytest.mark.parametrize(
@@ -577,7 +577,6 @@ def test_perfinjector_bubble_sort_parametrized_results() -> None:
577
577
],
578
578
)
579
579
def test_sort_parametrized(input, expected_output):
580
- print(datetime.datetime.now().isoformat())
581
580
output = sorter(input)
582
581
assert output == expected_output
583
582
"""
@@ -613,7 +612,6 @@ def test_sort_parametrized(input, expected_output):
613
612
"""import gc
614
613
import os
615
614
import time
616
- import datetime
617
615
618
616
import pytest
619
617
@@ -626,7 +624,6 @@ def test_sort_parametrized(input, expected_output):
626
624
@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)))])
627
625
def test_sort_parametrized(input, expected_output):
628
626
codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
629
- print(datetime.datetime.now().isoformat())
630
627
output = codeflash_wrap(sorter, '{module_path}', None, 'test_sort_parametrized', 'sorter', '0', codeflash_loop_index, input)
631
628
assert output == expected_output
632
629
"""
@@ -652,11 +649,11 @@ def test_sort_parametrized(input, expected_output):
652
649
func = FunctionToOptimize (function_name = "sorter" , parents = [], file_path = code_path )
653
650
os .chdir (run_cwd )
654
651
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
656
653
)
657
654
assert success
658
655
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
660
657
)
661
658
662
659
os .chdir (original_cwd )
0 commit comments