summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_fnmatch.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2008-10-02 18:55:37 (GMT)
committerGuido van Rossum <guido@python.org>2008-10-02 18:55:37 (GMT)
commitf0af3e30db9475ab68bcb1f1ce0b5581e214df76 (patch)
tree71efbc67686d96e8c8a81dd97c75c419adf36657 /Lib/test/test_fnmatch.py
parentfefeca53eebe8665c08ac0c041639ada3c9f9446 (diff)
downloadcpython-f0af3e30db9475ab68bcb1f1ce0b5581e214df76.zip
cpython-f0af3e30db9475ab68bcb1f1ce0b5581e214df76.tar.gz
cpython-f0af3e30db9475ab68bcb1f1ce0b5581e214df76.tar.bz2
Issue #3187: Better support for "undecodable" filenames. Code by Victor
Stinner, with small tweaks by GvR.
Diffstat (limited to 'Lib/test/test_fnmatch.py')
-rw-r--r--Lib/test/test_fnmatch.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_fnmatch.py b/Lib/test/test_fnmatch.py
index c593704..30ccf69 100644
--- a/Lib/test/test_fnmatch.py
+++ b/Lib/test/test_fnmatch.py
@@ -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)