Issue #3187: Better support for "undecodable" filenames. Code by Victor

Stinner, with small tweaks by GvR.
This commit is contained in:
Guido van Rossum 2008-10-02 18:55:37 +00:00
parent fefeca53ee
commit f0af3e30db
11 changed files with 359 additions and 145 deletions

View file

@ -37,6 +37,15 @@ class FnmatchTestCase(unittest.TestCase):
check('a', r'[!\]')
check('\\', r'[!\]', 0)
def test_mix_bytes_str(self):
self.assertRaises(TypeError, fnmatch, 'test', b'*')
self.assertRaises(TypeError, fnmatch, b'test', '*')
self.assertRaises(TypeError, fnmatchcase, 'test', b'*')
self.assertRaises(TypeError, fnmatchcase, b'test', '*')
def test_bytes(self):
self.check_match(b'test', b'te*')
self.check_match(b'test\xff', b'te*\xff')
def test_main():
support.run_unittest(FnmatchTestCase)