<s> """<STR_LIT>""" <EOL> from test import test_support <EOL> import unittest <EOL> from fnmatch import fnmatch , fnmatchcase , _MAXCACHE , _cache <EOL> from fnmatch import fnmatch , fnmatchcase , _MAXCACHE , _cache , _purge <EOL> class FnmatchTestCase ( unittest . TestCase ) : <EOL> def tearDown ( self ) : <EOL> _purge ( ) <EOL> def check_match ( self , filename , pattern , should_match = <NUM_LIT:1> , fn = fnmatch ) : <EOL> if should_match : <EOL> self . assertTrue ( fn ( filename , pattern ) , <EOL> "<STR_LIT>" <EOL> % ( filename , pattern ) ) <EOL> else : <EOL> self . assertTrue ( not fn ( filename , pattern ) , <EOL> "<STR_LIT>" <EOL> % ( filename , pattern ) ) <EOL> def test_fnmatch ( self ) : <EOL> check = self . check_match <EOL> check ( '<STR_LIT:abc>' , '<STR_LIT:abc>' ) <EOL> check ( '<STR_LIT:abc>' , '<STR_LIT>' ) <EOL> check ( '<STR_LIT:abc>' , '<STR_LIT>' ) <EOL> check ( '<STR_LIT:abc>' , '<STR_LIT>' ) <EOL> check ( '<STR_LIT:abc>' , '<STR_LIT>' ) <EOL> check ( '<STR_LIT:abc>' , '<STR_LIT:*>' ) <EOL> check ( '<STR_LIT:abc>' , '<STR_LIT>' ) <EOL> check ( '<STR_LIT:abc>' , '<STR_LIT>' ) <EOL> check ( '<STR_LIT:abc>' , '<STR_LIT>' , <NUM_LIT:0> ) <EOL> check ( '<STR_LIT:a>' , '<STR_LIT>' , <NUM_LIT:0> ) <EOL> check ( '<STR_LIT:a>' , '<STR_LIT:b>' , <NUM_LIT:0> ) <EOL> check ( '<STR_LIT:\\>' , r'<STR_LIT>' ) <EOL> check ( '<STR_LIT:a>' , r'<STR_LIT>' ) <EOL> check ( '<STR_LIT:\\>' , r'<STR_LIT>' , <NUM_LIT:0> ) <EOL> check ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> check ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> check ( '<STR_LIT>' , '<STR_LIT>' , False ) <EOL> check ( '<STR_LIT:\n>' , '<STR_LIT:*>' ) <EOL> def test_fnmatchcase ( self ) : <EOL> check = self . check_match <EOL> check ( '<STR_LIT>' , '<STR_LIT:abc>' , <NUM_LIT:0> , fnmatchcase ) <EOL> check ( '<STR_LIT:abc>' , '<STR_LIT>' , <NUM_LIT:0> , fnmatchcase ) <EOL> def test_cache_clearing ( self ) : <EOL> for i in range ( _MAXCACHE + <NUM_LIT:1> ) : <EOL> fnmatch ( '<STR_LIT:foo>' , '<STR_LIT:?>' * i ) <EOL> self . assertLessEqual ( len ( _cache ) , _MAXCACHE ) <EOL> def test_main ( ) : <EOL> test_support . run_unittest ( FnmatchTestCase ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> test_main ( ) </s>
