Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def evaluate(cls, case):
"""Evaluate matches."""
flags = case[3]
flags = cls.flags ^ flags
print("PATTERN: ", case[0])
print("FILE: ", case[1])
print("FLAGS: ", bin(flags))
print("TEST: ", case[2], '\n')
cls.assert_equal(fnmatch.fnmatch(case[1], case[0], flags=flags), case[2])
cls.assert_equal(
fnmatch.fnmatch(case[1], case[0], flags=flags | fnmatch.SPLIT), case[2]
)
def test_limit_fnmatch(self):
"""Test expansion limit of `fnmatch`."""
with self.assertRaises(_wcparse.PatternLimitException):
fnmatch.fnmatch('name', '{1..11}', flags=fnmatch.BRACE, limit=10)
def test_default_compile(self):
"""Test default with exclusion."""
self.assertTrue(fnmatch.fnmatch('name', '!test', flags=fnmatch.N | fnmatch.A))
self.assertTrue(fnmatch.fnmatch(b'name', b'!test', flags=fnmatch.N | fnmatch.A))
def test_default_compile(self):
"""Test default with exclusion."""
self.assertTrue(fnmatch.fnmatch('name', '!test', flags=fnmatch.N | fnmatch.A))
self.assertTrue(fnmatch.fnmatch(b'name', b'!test', flags=fnmatch.N | fnmatch.A))
def match(self, category, pattern):
"""Match the category."""
return fnmatch.fnmatch(category, pattern, flags=self.FNMATCH_FLAGS)