How to use the autohooks.api.path.match function in autohooks

To help you get started, we’ve selected a few autohooks examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github greenbone / autohooks / tests / api / test_path.py View on Github external
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))
github greenbone / autohooks / tests / api / test_path.py View on Github external
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))
github greenbone / autohooks / tests / api / test_path.py View on Github external
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))
github greenbone / autohooks / tests / api / test_path.py View on Github external
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))
github greenbone / autohooks / tests / api / test_path.py View on Github external
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))
github greenbone / autohooks / tests / api / test_path.py View on Github external
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))