Skip to content
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
14 changes: 14 additions & 0 deletions tests/test_05_pathspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,20 @@ class PathSpecTest(PathSpecMixin, TestCase):
The :class:`PathSpecTest` class tests the :class:`.PathSpec` class.
"""

def test_match_files_preserves_path_objects_and_duplicates(self):
files = [Path('a.txt'), Path('b.log'), Path('c.txt'), Path('a.txt')]
for sub_test in self.parameterize_from_lines('gitignore', ['*.txt']):
with sub_test() as spec:
for negate, expected in (
(False, [files[0], files[2], files[3]]),
(True, [files[1]]),
):
with self.subTest(negate=negate):
actual = list(spec.match_files(iter(files), negate=negate))
self.assertEqual(actual, expected)
for result, original in zip(actual, expected):
self.assertIs(result, original)

def test_01_absolute_dir_paths_1(self):
"""
Tests that absolute paths will be properly normalized and matched.
Expand Down