Skip to content

Commit

Permalink
Added test for excluding directories. cpburnz/python-pathspec#41 adri…
Browse files Browse the repository at this point in the history
  • Loading branch information
excitoon committed Aug 28, 2022
1 parent 7a36c29 commit 6f760f8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/test_match.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,12 @@ def test_single_letter(self):
self.assertTrue(matches("/home/michael/b/a", is_dir=is_dir))
self.assertTrue(matches("/home/michael/a/b", is_dir=is_dir))

def test_exclude_directories(self):
matches = self.__parse_gitignore_string(["*.yaml", "!*.yaml/"], fake_base_dir="/home/michael")
self.assertTrue(matches("/home/michael/file.yaml", is_dir=False))
self.assertFalse(matches("/home/michael/file.yaml", is_dir=True))
self.assertFalse(matches("/home/michael/dir.yaml/file.sql", is_dir=False))

def test_ignore_all_subdirectories(self):
matches = self.__parse_gitignore_string(["**/"], fake_base_dir="/home/michael")
for is_dir in (False, True):
Expand Down

0 comments on commit 6f760f8

Please sign in to comment.