Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_match_files_in_subdir(self):
patterns = ('foo/*.py', 'bar/*.js')
self.assertFalse(match(Path('foo.py'), patterns))
self.assertFalse(match(Path('foo.js'), patterns))
self.assertFalse(match(Path('foo.pyc'), patterns))
self.assertFalse(match(Path('foo.c'), patterns))
self.assertTrue(match(Path('foo/bar.py'), patterns))
self.assertTrue(match(Path('bar/foo.js'), patterns))
self.assertFalse(match(Path('foo/bar.js'), patterns))
self.assertFalse(match(Path('bar/foo.py'), patterns))
def test_match_tuple(self):
patterns = ('*.py', '*.js')
self.assertTrue(match(Path('foo.py'), patterns))
self.assertTrue(match(Path('foo.js'), patterns))
self.assertTrue(match(Path('path/to/foo.py'), patterns))
self.assertTrue(match(Path('/root/path/to/foo.py'), patterns))
self.assertFalse(match(Path('foo.pyc'), patterns))
self.assertFalse(match(Path('foo.c'), patterns))
def test_match_list(self):
patterns = ['*.py', '*.js']
self.assertTrue(match(Path('foo.py'), patterns))
self.assertTrue(match(Path('foo.js'), patterns))
self.assertTrue(match(Path('path/to/foo.py'), patterns))
self.assertTrue(match(Path('/root/path/to/foo.py'), patterns))
self.assertFalse(match(Path('foo.pyc'), patterns))
self.assertFalse(match(Path('foo.c'), patterns))
def test_match_tuple(self):
patterns = ('*.py', '*.js')
self.assertTrue(match(Path('foo.py'), patterns))
self.assertTrue(match(Path('foo.js'), patterns))
self.assertTrue(match(Path('path/to/foo.py'), patterns))
self.assertTrue(match(Path('/root/path/to/foo.py'), patterns))
self.assertFalse(match(Path('foo.pyc'), patterns))
self.assertFalse(match(Path('foo.c'), patterns))
def test_match_files_in_subdir(self):
patterns = ('foo/*.py', 'bar/*.js')
self.assertFalse(match(Path('foo.py'), patterns))
self.assertFalse(match(Path('foo.js'), patterns))
self.assertFalse(match(Path('foo.pyc'), patterns))
self.assertFalse(match(Path('foo.c'), patterns))
self.assertTrue(match(Path('foo/bar.py'), patterns))
self.assertTrue(match(Path('bar/foo.js'), patterns))
self.assertFalse(match(Path('foo/bar.js'), patterns))
self.assertFalse(match(Path('bar/foo.py'), patterns))
def test_match_list(self):
patterns = ['*.py', '*.js']
self.assertTrue(match(Path('foo.py'), patterns))
self.assertTrue(match(Path('foo.js'), patterns))
self.assertTrue(match(Path('path/to/foo.py'), patterns))
self.assertTrue(match(Path('/root/path/to/foo.py'), patterns))
self.assertFalse(match(Path('foo.pyc'), patterns))
self.assertFalse(match(Path('foo.c'), patterns))