mirror of https://github.com/python/cpython
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:
parent
a241d0a8a2
commit
4bd4585f8e
|
@ -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():
|
||||
|
|
Loading…
Reference in New Issue