Changeset 391 for python/trunk/Lib/test/test_fnmatch.py
- Timestamp:
- Mar 19, 2014, 11:31:01 PM (11 years ago)
- Location:
- python/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
python/trunk
-
Property svn:mergeinfo
set to
/python/vendor/Python-2.7.6 merged eligible /python/vendor/current merged eligible
-
Property svn:mergeinfo
set to
-
python/trunk/Lib/test/test_fnmatch.py
r2 r391 4 4 import unittest 5 5 6 from fnmatch import fnmatch, fnmatchcase 6 from fnmatch import fnmatch, fnmatchcase, _MAXCACHE, _cache 7 from fnmatch import fnmatch, fnmatchcase, _MAXCACHE, _cache, _purge 7 8 8 9 9 10 class FnmatchTestCase(unittest.TestCase): 11 12 def tearDown(self): 13 _purge() 14 10 15 def check_match(self, filename, pattern, should_match=1, fn=fnmatch): 11 16 if should_match: 12 17 self.assertTrue(fn(filename, pattern), 13 14 18 "expected %r to match pattern %r" 19 % (filename, pattern)) 15 20 else: 16 21 self.assertTrue(not fn(filename, pattern), 17 18 22 "expected %r not to match pattern %r" 23 % (filename, pattern)) 19 24 20 25 def test_fnmatch(self): … … 50 55 check('abc', 'AbC', 0, fnmatchcase) 51 56 57 def test_cache_clearing(self): 58 # check that caches do not grow too large 59 # http://bugs.python.org/issue7846 60 61 # string pattern cache 62 for i in range(_MAXCACHE + 1): 63 fnmatch('foo', '?' * i) 64 65 self.assertLessEqual(len(_cache), _MAXCACHE) 52 66 53 67 def test_main():
Note:
See TracChangeset
for help on using the changeset viewer.