Skip to content

Commit 328c837

Browse files
committed
formatting
1 parent f0e36b8 commit 328c837

1 file changed

Lines changed: 5 additions & 15 deletions

File tree

codeflash/discovery/functions_to_optimize.py

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -875,17 +875,8 @@ def filter_functions(
875875
)
876876

877877
# Test file patterns for when tests_root overlaps with source
878-
test_file_name_patterns = (
879-
".test.",
880-
".spec.",
881-
"_test.",
882-
"_spec.",
883-
)
884-
test_dir_patterns = (
885-
os.sep + "test" + os.sep,
886-
os.sep + "tests" + os.sep,
887-
os.sep + "__tests__" + os.sep,
888-
)
878+
test_file_name_patterns = (".test.", ".spec.", "_test.", "_spec.")
879+
test_dir_patterns = (os.sep + "test" + os.sep, os.sep + "tests" + os.sep, os.sep + "__tests__" + os.sep)
889880

890881
def is_test_file(file_path_normalized: str) -> bool:
891882
"""Check if a file is a test file based on patterns."""
@@ -899,11 +890,10 @@ def is_test_file(file_path_normalized: str) -> bool:
899890
# to avoid false positives from parent directories
900891
relative_path = file_lower
901892
if project_root_str and file_lower.startswith(project_root_str.lower()):
902-
relative_path = file_lower[len(project_root_str):]
893+
relative_path = file_lower[len(project_root_str) :]
903894
return any(pattern in relative_path for pattern in test_dir_patterns)
904-
else:
905-
# Use directory-based filtering when tests are in a separate directory
906-
return file_path_normalized.startswith(tests_root_str + os.sep)
895+
# Use directory-based filtering when tests are in a separate directory
896+
return file_path_normalized.startswith(tests_root_str + os.sep)
907897

908898
# We desperately need Python 3.10+ only support to make this code readable with structural pattern matching
909899
for file_path_path, functions in modified_functions.items():

0 commit comments

Comments
 (0)