Skip to content

Commit

Permalink
Add more tests for file pattern (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
kunaltyagi authored Oct 27, 2024
1 parent bb77fc4 commit ff8d02a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/test_file_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,27 @@ def test_non_recursive_exclude(simple_filter: Filter):
simple_filter.AddExclude("*.py")
assert not simple_filter.CheckFileInclusion("hello.py")
assert simple_filter.CheckFileInclusion("SomeDir/hello.py")
assert simple_filter.CheckFileInclusion("ParentDir/SomeDir/hello.py")

simple_filter.AddExclude("*/*.py")
assert not simple_filter.CheckFileInclusion("SomeDir/hello.py")
assert simple_filter.CheckFileInclusion("ParentDir/SomeDir/hello.py")


@pytest.mark.skipif(sys.version_info < (3, 13), reason="Needs new glob features from 3.13")
def test_recursive_exclude(simple_filter: Filter):
simple_filter.AddExclude("**/*.py")
assert not simple_filter.CheckFileInclusion("hello.py")
assert not simple_filter.CheckFileInclusion("SomeDir/hello.py")
assert not simple_filter.CheckFileInclusion("ParentDir/SomeDir/hello.py")


@pytest.mark.skipif(sys.version_info < (3, 13), reason="Needs new glob features from 3.13")
def test_mix_exclude(simple_filter: Filter):
simple_filter.AddExclude("test/**/*.py")
assert simple_filter.CheckFileInclusion("hello.py")
assert not simple_filter.CheckFileInclusion("test/hello.py")
assert not simple_filter.CheckFileInclusion("test/SomeDir/hello.py")


def test_prefix_match(simple_filter: Filter):
Expand Down

0 comments on commit ff8d02a

Please sign in to comment.