Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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
@@ -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):
@@ -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):
Loading
Oops, something went wrong.