From 56743115e7418ea4203c58e0ed9f1064fc57a288 Mon Sep 17 00:00:00 2001 From: Daniel Sada Date: Mon, 27 Jan 2025 23:38:57 +0000 Subject: [PATCH] Add additional test cases for pattern matching in test_match.py which fail today. --- tests/unit/utils/test_match.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/unit/utils/test_match.py b/tests/unit/utils/test_match.py index cd0121668..406ce6b5f 100644 --- a/tests/unit/utils/test_match.py +++ b/tests/unit/utils/test_match.py @@ -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):