How to use the wcmatch.glob.glob function in wcmatch

To help you get started, we’ve selected a few wcmatch 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 facelessuser / wcmatch / tests / test_globmatch.py View on Github external
)
        self.assertTrue(
            all(
                [
                    glob.globmatch(
                        x, './**/./../*.py', flags=self.flags
                    ) for x in glob.glob('./**/./../*.py', flags=self.flags)
                ]
            )
        )
        self.assertTrue(
            all(
                [
                    glob.globmatch(
                        x, './///**///./../*.py', flags=self.flags
                    ) for x in glob.glob('./**/.//////..////*.py', flags=self.flags)
                ]
            )
        )
        self.assertTrue(
            all(
                [
                    glob.globmatch(
                        x, '**/docs/**', flags=self.flags
                    ) for x in glob.glob('**/docs/**', flags=self.flags)
                ]
            )
        )
        self.assertTrue(
            all(
                [
                    glob.globmatch(
github facelessuser / wcmatch / tests / test_glob.py View on Github external
def test_cwd(self):
        """Test root level glob on current working directory."""

        with change_cwd(self.tempdir):
            self.assert_equal(glob.glob('EF'), ['EF'])
github facelessuser / wcmatch / tests / test_globmatch.py View on Github external
self.assertTrue(
            all(
                [
                    glob.globmatch(
                        x, '**/docs/**|!**/*.md', flags=self.flags | glob.SPLIT
                    ) for x in glob.glob('**/docs/**|!**/*.md', flags=self.flags | glob.SPLIT)
                ]
            )
        )

        self.assertTrue(
            all(
                [
                    glob.globmatch(
                        x, '!**/*.md', flags=self.flags | glob.SPLIT
                    ) for x in glob.glob('!**/*.md', flags=self.flags | glob.SPLIT)
                ]
            )
        )
        self.assertFalse(
            all(
                [
                    glob.globmatch(
                        x, '**/docs/**|!**/*.md', flags=self.flags | glob.SPLIT
                    ) for x in glob.glob('**/docs/**', flags=self.flags | glob.SPLIT)
                ]
github facelessuser / wcmatch / tests / test_glob.py View on Github external
def test_drive_insensitive(self):
        """Test drive case insensitivity."""

        cwd = os.getcwd()
        filepath = os.path.join(cwd, 'README.md')
        self.assertEqual([filepath], glob.glob(filepath.replace('\\', '\\\\')))
        self.assertEqual(
            [self.RE_DRIVE.sub(lambda m: m.group(0).upper(), filepath)],
            glob.glob(filepath.replace('\\', '\\\\').upper())
        )
        self.assertEqual(
            [self.RE_DRIVE.sub(lambda m: m.group(0).lower(), filepath)],
            glob.glob(filepath.replace('\\', '\\\\').lower())
        )
github facelessuser / wcmatch / tests / test_glob.py View on Github external
def test_tilde(self):
        """Test tilde."""

        files = os.listdir(os.path.expanduser('~'))
        self.assertEqual(len(glob.glob('~/*', flags=glob.T | glob.D)), len(files))
github facelessuser / wcmatch / tests / test_globmatch.py View on Github external
self.assertTrue(
            all(
                [
                    glob.globmatch(
                        x, '**/docs/**|!**/*.md', flags=self.flags | glob.SPLIT | glob.MARK
                    ) for x in glob.glob('**/docs/**|!**/*.md', flags=self.flags | glob.SPLIT | glob.MARK)
                ]
            )
        )

        self.assertTrue(
            all(
                [
                    glob.globmatch(
                        x, '!**/*.md', flags=self.flags | glob.SPLIT | glob.MARK
                    ) for x in glob.glob('!**/*.md', flags=self.flags | glob.SPLIT | glob.MARK)
                ]
            )
        )
        self.assertFalse(
            all(
                [
                    glob.globmatch(
                        x, '**/docs/**|!**/*.md', flags=self.flags | glob.SPLIT | glob.MARK
                    ) for x in glob.glob('**/docs/**', flags=self.flags | glob.SPLIT | glob.MARK)
                ]
github facelessuser / wcmatch / tests / test_globmatch.py View on Github external
def test_tilde_globmatch_no_tilde(self):
        """Test tilde in `globmatch` environment but with tilde disabled."""

        files = os.listdir(os.path.expanduser('~'))
        gfiles = glob.globfilter(
            glob.glob('~/*', flags=glob.T | glob.D),
            '~/*', flags=glob.D | glob.P
        )

        self.assertNotEqual(len(files), len(gfiles))
github facelessuser / wcmatch / tests / test_globmatch.py View on Github external
# UNC mounts are special cases and it matters there.
        self.assertTrue(
            all(
                [
                    glob.globmatch(
                        x, '**/../*.{md,py}', flags=self.flags
                    ) for x in glob.glob('**/../*.{md,py}', flags=self.flags)
                ]
            )
        )
        self.assertTrue(
            all(
                [
                    glob.globmatch(
                        x, './**/./../*.py', flags=self.flags
                    ) for x in glob.glob('./**/./../*.py', flags=self.flags)
                ]
            )
        )
        self.assertTrue(
            all(
                [
                    glob.globmatch(
                        x, './///**///./../*.py', flags=self.flags
                    ) for x in glob.glob('./**/.//////..////*.py', flags=self.flags)
                ]
            )
        )
        self.assertTrue(
            all(
                [
                    glob.globmatch(
github facelessuser / wcmatch / tests / test_glob.py View on Github external
def test_drive_insensitive(self):
        """Test drive case insensitivity."""

        cwd = os.getcwd()
        filepath = os.path.join(cwd, 'README.md')
        self.assertEqual([filepath], glob.glob(filepath.replace('\\', '\\\\')))
        self.assertEqual(
            [self.RE_DRIVE.sub(lambda m: m.group(0).upper(), filepath)],
            glob.glob(filepath.replace('\\', '\\\\').upper())
        )
        self.assertEqual(
            [self.RE_DRIVE.sub(lambda m: m.group(0).lower(), filepath)],
            glob.glob(filepath.replace('\\', '\\\\').lower())
        )
github facelessuser / wcmatch / tests / test_glob.py View on Github external
def test_start(self):
        """Test that starting directory/files are handled properly."""

        self.assertEqual(
            sorted(['docs', 'wcmatch', 'readme.md']),
            sorted([each.lower() for each in glob.glob(['BAD', 'docs', 'WCMATCH', 'readme.MD'], flags=glob.I)])
        )