Skip to content

Commit

Permalink
Apply suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
aothms committed Sep 18, 2023
1 parent 1233972 commit d68a2b2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ def get_test_files():
Also applies for multiple files -> 'python3 test_main.py <path1>.ifc <path2>.ifc'
Codes and rules can also be combined -> 'python3 test_main.py alb001 <path>.ifc'
"""
args = [a for a in sys.argv[1:] if not a.startswith('-')]
rule_code_pattern = re.compile(r"^[a-zA-Z]{3}\d{3}$")
rule_codes = list(filter(lambda arg: rule_code_pattern.match(arg), [a for a in sys.argv[1:] if not a.startswith('-')]))
rule_codes = list(filter(lambda arg: rule_code_pattern.match(arg), args))

test_files = []
for code in rule_codes:
Expand All @@ -35,9 +36,9 @@ def get_test_files():
test_files.extend(paths)

file_pattern = r".*\.ifc(\')?$" #matches ".ifc" and "ifc'"
test_files.extend([s.strip("'") for s in sys.argv if re.match(file_pattern, s)])
test_files.extend([s.strip("'") for s in args if re.match(file_pattern, s)])

if not test_files: # for example, with 'pytest -sv'
if not args: # for example, with 'pytest -sv'
test_files = glob.glob(os.path.join(os.path.dirname(__file__), "files/**/*.ifc"), recursive=True)
return test_files

Expand Down

0 comments on commit d68a2b2

Please sign in to comment.