Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(78)

Side by Side Diff: Lib/test/test_fnmatch.py

Issue 3055: combined patches from http://bugs.python.org/issue3187 (Closed) SVN Base: http://svn.python.org/view/*checkout*/python/branches/py3k/
Patch Set: One more tweak (fold some long lines) Created 1 year, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 """Test cases for the fnmatch module.""" 1 """Test cases for the fnmatch module."""
2 2
3 from test import support 3 from test import support
4 import unittest 4 import unittest
5 5
6 from fnmatch import fnmatch, fnmatchcase 6 from fnmatch import fnmatch, fnmatchcase
7 7
8 8
9 class FnmatchTestCase(unittest.TestCase): 9 class FnmatchTestCase(unittest.TestCase):
10 def check_match(self, filename, pattern, should_match=1): 10 def check_match(self, filename, pattern, should_match=1):
(...skipping 19 matching lines...) Expand all
30 check('abc', 'ab[de]', 0) 30 check('abc', 'ab[de]', 0)
31 check('a', '??', 0) 31 check('a', '??', 0)
32 check('a', 'b', 0) 32 check('a', 'b', 0)
33 33
34 # these test that '\' is handled correctly in character sets; 34 # these test that '\' is handled correctly in character sets;
35 # see SF bug #??? 35 # see SF bug #???
36 check('\\', r'[\]') 36 check('\\', r'[\]')
37 check('a', r'[!\]') 37 check('a', r'[!\]')
38 check('\\', r'[!\]', 0) 38 check('\\', r'[!\]', 0)
39 39
40 def test_mix_bytes_str(self):
41 self.assertRaises(TypeError, fnmatch, 'test', b'*')
42 self.assertRaises(TypeError, fnmatch, b'test', '*')
43 self.assertRaises(TypeError, fnmatchcase, 'test', b'*')
44 self.assertRaises(TypeError, fnmatchcase, b'test', '*')
45
46 def test_bytes(self):
47 self.check_match(b'test', b'te*')
48 self.check_match(b'test\xff', b'te*\xff')
40 49
41 def test_main(): 50 def test_main():
42 support.run_unittest(FnmatchTestCase) 51 support.run_unittest(FnmatchTestCase)
43 52
44 53
45 if __name__ == "__main__": 54 if __name__ == "__main__":
46 test_main() 55 test_main()
OLDNEW

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld r483