Skip to content

Commit

Permalink
added if guard test case
Browse files Browse the repository at this point in the history
  • Loading branch information
dillonalaird committed Oct 15, 2024
1 parent d9327e2 commit b84319b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/unit/test_vac.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,16 @@ def check_helmets(image_path):
# The function can be called with the image path"""
code_out = strip_function_calls(code, exclusions=["register_heif_opener"])
assert code_out == expected_code


def test_strip_function_call_if_name_equal_main():
code = """import os
def f():
print("Hello!")
if __name__ == "__main__":
f()"""
expected_code = """import os
def f():
print("Hello!")"""
code_out = strip_function_calls(code)
assert code_out == expected_code

0 comments on commit b84319b

Please sign in to comment.