Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Add additional test cases for pattern matching in test_match.py which fail today. #491

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions tests/unit/utils/test_match.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@
([".*", "!patch"], "main", True),
(["!patch", "main"], "main", True),
(["featur$"], "feature", False),
(["/folder/.*"], "/folder/file", True),
(["/folder/.*"], "/file", False),
(["/.*"], "/any/path", True),
(["/.*", "!/exclude"], "/exclude", False),
(["!/exclude"], "/exclude", False),
(["!/exclude"], "/include", True),
(["*.py"], "file.py", True),
(["*.py"], "file.txt", False),
(["folder/*.py"], "folder/file.py", True),
(["folder/*.py"], "folder/file.txt", False),
(["**/*.py"], "folder/subfolder/file.py", True),
(["**/*.py"], "folder/subfolder/file.txt", False),
],
)
def test_match(patterns, string, boolean):
Expand All @@ -41,6 +53,16 @@ def test_match(patterns, string, boolean):
(["folder"], ["file", "folder"], True),
(["folder"], ["file"], False),
(["folder"], ["file", "another"], False),
(["/folder/.*"], ["/folder/file", Exception()], True),
(["/folder"], ["/file", "/folder"], True),
(["/folder"], ["/file"], False),
(["/folder"], ["/file", "/another"], False),
(["*.py"], ["file.py", Exception()], True),
(["*.py"], ["file.txt", Exception()], False),
(["folder/*.py"], ["folder/file.py", Exception()], True),
(["folder/*.py"], ["folder/file.txt", Exception()], False),
(["**/*.py"], ["folder/subfolder/file.py", Exception()], True),
(["**/*.py"], ["folder/subfolder/file.txt", Exception()], False),
],
)
def test_match_any(patterns, match_any_of_these, boolean):
Expand Down
Loading