Skip to content

Commit ff8d02a

Browse files
authored
Add more tests for file pattern (#74)
1 parent bb77fc4 commit ff8d02a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/test_file_filter.py

+14
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,27 @@ def test_non_recursive_exclude(simple_filter: Filter):
1515
simple_filter.AddExclude("*.py")
1616
assert not simple_filter.CheckFileInclusion("hello.py")
1717
assert simple_filter.CheckFileInclusion("SomeDir/hello.py")
18+
assert simple_filter.CheckFileInclusion("ParentDir/SomeDir/hello.py")
19+
20+
simple_filter.AddExclude("*/*.py")
21+
assert not simple_filter.CheckFileInclusion("SomeDir/hello.py")
22+
assert simple_filter.CheckFileInclusion("ParentDir/SomeDir/hello.py")
1823

1924

2025
@pytest.mark.skipif(sys.version_info < (3, 13), reason="Needs new glob features from 3.13")
2126
def test_recursive_exclude(simple_filter: Filter):
2227
simple_filter.AddExclude("**/*.py")
2328
assert not simple_filter.CheckFileInclusion("hello.py")
2429
assert not simple_filter.CheckFileInclusion("SomeDir/hello.py")
30+
assert not simple_filter.CheckFileInclusion("ParentDir/SomeDir/hello.py")
31+
32+
33+
@pytest.mark.skipif(sys.version_info < (3, 13), reason="Needs new glob features from 3.13")
34+
def test_mix_exclude(simple_filter: Filter):
35+
simple_filter.AddExclude("test/**/*.py")
36+
assert simple_filter.CheckFileInclusion("hello.py")
37+
assert not simple_filter.CheckFileInclusion("test/hello.py")
38+
assert not simple_filter.CheckFileInclusion("test/SomeDir/hello.py")
2539

2640

2741
def test_prefix_match(simple_filter: Filter):

0 commit comments

Comments
 (0)