Skip to content

Commit 1bde518

Browse files
committed
normalize the string comparison
Signed-off-by: Saurabh Misra <[email protected]>
1 parent 3a44a44 commit 1bde518

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

tests/test_instrument_tests.py

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,7 @@ def codeflash_wrap(wrapped, test_module_name, test_class_name, test_name, functi
129129
codeflash_test_index = codeflash_wrap.index[test_id]
130130
invocation_id = f'{{line_id}}_{{codeflash_test_index}}'
131131
"""
132-
if sys.version_info < (3, 12):
133-
expected += """test_stdout_tag = f"{{test_module_name}}:{{(test_class_name + '.' if test_class_name else '')}}{{test_name}}:{{function_name}}:{{loop_index}}:{{invocation_id}}"
134-
"""
135-
else:
136-
expected += """test_stdout_tag = f'{{test_module_name}}:{{(test_class_name + '.' if test_class_name else '')}}{{test_name}}:{{function_name}}:{{loop_index}}:{{invocation_id}}'
132+
expected += """test_stdout_tag = f'{{test_module_name}}:{{(test_class_name + '.' if test_class_name else '')}}{{test_name}}:{{function_name}}:{{loop_index}}:{{invocation_id}}'
137133
"""
138134
expected += """print(f'!$######{{test_stdout_tag}}######$!')
139135
exception = None
@@ -189,9 +185,9 @@ def test_sort(self):
189185
)
190186
os.chdir(original_cwd)
191187
assert success
192-
assert new_test == expected.format(
188+
assert new_test.replace('"', "'") == expected.format(
193189
module_path=Path(f.name).name, tmp_dir_path=get_run_tmp_file(Path("test_return_values"))
194-
)
190+
).replace('"', "'")
195191

196192

197193
def test_perfinjector_only_replay_test() -> None:
@@ -233,11 +229,7 @@ def codeflash_wrap(wrapped, test_module_name, test_class_name, test_name, functi
233229
codeflash_test_index = codeflash_wrap.index[test_id]
234230
invocation_id = f'{{line_id}}_{{codeflash_test_index}}'
235231
"""
236-
if sys.version_info < (3, 12):
237-
expected += """test_stdout_tag = f"{{test_module_name}}:{{(test_class_name + '.' if test_class_name else '')}}{{test_name}}:{{function_name}}:{{loop_index}}:{{invocation_id}}"
238-
"""
239-
else:
240-
expected += """test_stdout_tag = f'{{test_module_name}}:{{(test_class_name + '.' if test_class_name else '')}}{{test_name}}:{{function_name}}:{{loop_index}}:{{invocation_id}}'
232+
expected += """test_stdout_tag = f'{{test_module_name}}:{{(test_class_name + '.' if test_class_name else '')}}{{test_name}}:{{function_name}}:{{loop_index}}:{{invocation_id}}'
241233
"""
242234
expected += """print(f'!$######{{test_stdout_tag}}######$!')
243235
exception = None
@@ -289,9 +281,9 @@ def test_prepare_image_for_yolo():
289281
)
290282
os.chdir(original_cwd)
291283
assert success
292-
assert new_test == expected.format(
284+
assert new_test.replace('"', "'") == expected.format(
293285
module_path=Path(f.name).name, tmp_dir_path=get_run_tmp_file(Path("test_return_values"))
294-
)
286+
).replace('"', "'")
295287

296288

297289
def test_perfinjector_bubble_sort_results() -> None:

0 commit comments

Comments
 (0)