Skip to content

Commit 1a4f60e

Browse files
committed
Update test_codeflash_capture.py
1 parent 3147c4a commit 1a4f60e

File tree

1 file changed

+46
-1
lines changed

1 file changed

+46
-1
lines changed

tests/test_codeflash_capture.py

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,6 @@ def __init__(self, x=2):
485485
assert test_results[1].id.test_module_path == "code_to_optimize.tests.pytest.test_codeflash_capture_temp"
486486
assert test_results[1].id.function_getting_tested == "some_function"
487487
assert test_results[1].id.iteration_id == "11_0"
488-
489488
assert test_results[2].did_pass
490489
assert test_results[2].return_value[0]["x"] == 2
491490
assert test_results[2].id.test_function_name == "test_example_test_3"
@@ -494,6 +493,17 @@ def __init__(self, x=2):
494493
assert test_results[2].id.function_getting_tested == "some_function"
495494
assert test_results[2].id.iteration_id == "16_0"
496495

496+
test_results2, _ = func_optimizer.run_and_parse_tests(
497+
testing_type=TestingMode.BEHAVIOR,
498+
test_env=test_env,
499+
test_files=func_optimizer.test_files,
500+
optimization_iteration=0,
501+
pytest_min_loops=1,
502+
pytest_max_loops=1,
503+
testing_time=0.1,
504+
)
505+
assert compare_test_results(test_results, test_results2)
506+
497507
finally:
498508
test_path.unlink(missing_ok=True)
499509
sample_code_path.unlink(missing_ok=True)
@@ -605,6 +615,18 @@ def __init__(self, *args, **kwargs):
605615
assert test_results[2].id.function_getting_tested == "some_function"
606616
assert test_results[2].id.iteration_id == "16_0"
607617

618+
results2, _ = func_optimizer.run_and_parse_tests(
619+
testing_type=TestingMode.BEHAVIOR,
620+
test_env=test_env,
621+
test_files=func_optimizer.test_files,
622+
optimization_iteration=0,
623+
pytest_min_loops=1,
624+
pytest_max_loops=1,
625+
testing_time=0.1,
626+
)
627+
628+
assert compare_test_results(test_results, results2)
629+
608630
finally:
609631
test_path.unlink(missing_ok=True)
610632
sample_code_path.unlink(missing_ok=True)
@@ -720,6 +742,17 @@ def __init__(self, x=2):
720742
assert test_results[2].id.function_getting_tested == "some_function"
721743
assert test_results[2].id.iteration_id == "12_2" # Third call
722744

745+
test_results2, _ = func_optimizer.run_and_parse_tests(
746+
testing_type=TestingMode.BEHAVIOR,
747+
test_env=test_env,
748+
test_files=func_optimizer.test_files,
749+
optimization_iteration=0,
750+
pytest_min_loops=1,
751+
pytest_max_loops=1,
752+
testing_time=0.1,
753+
)
754+
755+
assert compare_test_results(test_results, test_results2)
723756
finally:
724757
test_path.unlink(missing_ok=True)
725758
sample_code_path.unlink(missing_ok=True)
@@ -856,6 +889,18 @@ def another_helper(self):
856889
assert test_results[3].id.function_getting_tested == "AnotherHelperClass.__init__"
857890
assert test_results[3].verification_type == VerificationType.INIT_STATE_HELPER
858891

892+
results2, _ = func_optimizer.run_and_parse_tests(
893+
testing_type=TestingMode.BEHAVIOR,
894+
test_env=test_env,
895+
test_files=func_optimizer.test_files,
896+
optimization_iteration=0,
897+
pytest_min_loops=1,
898+
pytest_max_loops=1,
899+
testing_time=0.1,
900+
)
901+
902+
assert compare_test_results(test_results, results2)
903+
859904
finally:
860905
test_path.unlink(missing_ok=True)
861906
fto_file_path.unlink(missing_ok=True)

0 commit comments

Comments
 (0)