Merged revisions 78101 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78101 | georg.brandl | 2010-02-08 02:04:54 +0200 (Mon, 08 Feb 2010) | 1 line

  Fix test_fnmatch.
........
This commit is contained in:
Ezio Melotti 2010-02-20 22:56:58 +00:00
parent a241d0a8a2
commit 4bd4585f8e
1 changed files with 9 additions and 9 deletions

View File

@ -7,15 +7,15 @@ from fnmatch import fnmatch, fnmatchcase
class FnmatchTestCase(unittest.TestCase):
def check_match(self, filename, pattern, should_match=1):
def check_match(self, filename, pattern, should_match=1, fn=fnmatch):
if should_match:
self.assert_(fnmatch(filename, pattern),
"expected %r to match pattern %r"
% (filename, pattern))
self.assertTrue(fn(filename, pattern),
"expected %r to match pattern %r"
% (filename, pattern))
else:
self.assert_(not fnmatch(filename, pattern),
"expected %r not to match pattern %r"
% (filename, pattern))
self.assertTrue(not fn(filename, pattern),
"expected %r not to match pattern %r"
% (filename, pattern))
def test_fnmatch(self):
check = self.check_match
@ -46,8 +46,8 @@ class FnmatchTestCase(unittest.TestCase):
def test_fnmatchcase(self):
check = self.check_match
check('AbC', 'abc', 0)
check('abc', 'AbC', 0)
check('AbC', 'abc', 0, fnmatchcase)
check('abc', 'AbC', 0, fnmatchcase)
def test_main():