<s> """<STR_LIT>""" <EOL> import os <EOL> import test . test_support <EOL> import unittest <EOL> import whichdb <EOL> import glob <EOL> _fname = test . test_support . TESTFN <EOL> anydbm = test . test_support . import_module ( '<STR_LIT>' , deprecated = True ) <EOL> def _delete_files ( ) : <EOL> for f in glob . glob ( _fname + "<STR_LIT:*>" ) : <EOL> try : <EOL> os . unlink ( f ) <EOL> except OSError : <EOL> pass <EOL> class WhichDBTestCase ( unittest . TestCase ) : <EOL> def __init__ ( self , * args ) : <EOL> unittest . TestCase . __init__ ( self , * args ) <EOL> def tearDown ( self ) : <EOL> _delete_files ( ) <EOL> def setUp ( self ) : <EOL> _delete_files ( ) <EOL> for name in anydbm . _names : <EOL> try : <EOL> mod = test . test_support . import_module ( name , deprecated = True ) <EOL> except unittest . SkipTest : <EOL> continue <EOL> def test_whichdb_name ( self , name = name , mod = mod ) : <EOL> f = mod . open ( _fname , '<STR_LIT:c>' ) <EOL> f . close ( ) <EOL> self . assertEqual ( name , whichdb . whichdb ( _fname ) ) <EOL> f = mod . open ( _fname , '<STR_LIT:w>' ) <EOL> f [ "<STR_LIT:1>" ] = "<STR_LIT:1>" <EOL> f . close ( ) <EOL> self . assertEqual ( name , whichdb . whichdb ( _fname ) ) <EOL> setattr ( WhichDBTestCase , "<STR_LIT>" % name , test_whichdb_name ) <EOL> def test_main ( ) : <EOL> try : <EOL> test . test_support . run_unittest ( WhichDBTestCase ) <EOL> finally : <EOL> _delete_files ( ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> test_main ( ) </s>
