@@ -168,6 +168,13 @@ def test_sort():
168168            pytest_max_loops = 1 ,
169169            testing_time = 0.1 ,
170170        )
171+ 
172+         out_str  =  """codeflash stdout: Sorting list 
173+ result: [0, 1, 2, 3, 4, 5] 
174+ 
175+ codeflash stdout: Sorting list 
176+ result: [0.0, 1.0, 2.0, 3.0, 4.0, 5.0]""" 
177+         assert  out_str  ==  test_results [0 ].stdout 
171178        assert  test_results [0 ].id .function_getting_tested  ==  "sorter" 
172179        assert  test_results [0 ].id .iteration_id  ==  "1_0" 
173180        assert  test_results [0 ].id .test_class_name  is  None 
@@ -179,6 +186,7 @@ def test_sort():
179186        assert  test_results [0 ].runtime  >  0 
180187        assert  test_results [0 ].did_pass 
181188        assert  test_results [0 ].return_value  ==  ([0 , 1 , 2 , 3 , 4 , 5 ],)
189+         assert  out_str  ==  test_results [1 ].stdout .strip ()
182190
183191        assert  test_results [1 ].id .function_getting_tested  ==  "sorter" 
184192        assert  test_results [1 ].id .iteration_id  ==  "4_0" 
@@ -190,6 +198,22 @@ def test_sort():
190198        )
191199        assert  test_results [1 ].runtime  >  0 
192200        assert  test_results [1 ].did_pass 
201+         results2 , _  =  func_optimizer .run_and_parse_tests (
202+             testing_type = TestingMode .BEHAVIOR ,
203+             test_env = test_env ,
204+             test_files = func_optimizer .test_files ,
205+             optimization_iteration = 0 ,
206+             pytest_min_loops = 1 ,
207+             pytest_max_loops = 1 ,
208+             testing_time = 0.1 ,
209+         )
210+         out_str  =  """codeflash stdout: Sorting list 
211+ result: [0, 1, 2, 3, 4, 5] 
212+ 
213+ codeflash stdout: Sorting list 
214+ result: [0.0, 1.0, 2.0, 3.0, 4.0, 5.0]""" 
215+         assert  out_str  ==  results2 [0 ].stdout .strip ()
216+         assert  compare_test_results (test_results , results2 )
193217    finally :
194218        fto_path .write_text (original_code , "utf-8" )
195219        test_path .unlink (missing_ok = True )
@@ -340,13 +364,11 @@ def test_sort():
340364            pytest_max_loops = 1 ,
341365            testing_time = 0.1 ,
342366        )
343- 
344367        assert  len (test_results ) ==  4 
345368        assert  test_results [0 ].id .function_getting_tested  ==  "BubbleSorter.__init__" 
346369        assert  test_results [0 ].id .test_function_name  ==  "test_sort" 
347370        assert  test_results [0 ].did_pass 
348371        assert  test_results [0 ].return_value [0 ] ==  {"x" : 0 }
349- 
350372        assert  test_results [1 ].id .function_getting_tested  ==  "BubbleSorter.sorter" 
351373        assert  test_results [1 ].id .iteration_id  ==  "2_0" 
352374        assert  test_results [1 ].id .test_class_name  is  None 
@@ -358,7 +380,9 @@ def test_sort():
358380        assert  test_results [1 ].runtime  >  0 
359381        assert  test_results [1 ].did_pass 
360382        assert  test_results [1 ].return_value  ==  ([0 , 1 , 2 , 3 , 4 , 5 ],)
361- 
383+         out_str  =  """codeflash stdout : BubbleSorter.sorter() called\n \n \n codeflash stdout : BubbleSorter.sorter() called""" 
384+         assert  test_results [1 ].stdout  ==  out_str 
385+         assert  compare_test_results (test_results , test_results )
362386        assert  test_results [2 ].id .function_getting_tested  ==  "BubbleSorter.__init__" 
363387        assert  test_results [2 ].id .test_function_name  ==  "test_sort" 
364388        assert  test_results [2 ].did_pass 
@@ -375,6 +399,18 @@ def test_sort():
375399        assert  test_results [3 ].runtime  >  0 
376400        assert  test_results [3 ].did_pass 
377401
402+         results2 , _  =  func_optimizer .run_and_parse_tests (
403+             testing_type = TestingMode .BEHAVIOR ,
404+             test_env = test_env ,
405+             test_files = func_optimizer .test_files ,
406+             optimization_iteration = 0 ,
407+             pytest_min_loops = 1 ,
408+             pytest_max_loops = 1 ,
409+             testing_time = 0.1 ,
410+         )
411+ 
412+         assert  compare_test_results (test_results , results2 )
413+ 
378414        # Replace with optimized code that mutated instance attribute 
379415        optimized_code  =  """ 
380416class BubbleSorter: 
0 commit comments