#NEWLINE# def _testBogusZipFile( self ) : #NEWLINE# #INDENT# support . unlink ( TESTMOD ) #NEWLINE# fp = open ( TESTMOD , 'w+' ) #NEWLINE# fp . write ( struct . pack ( '=I' , 101010256 ) ) #NEWLINE# fp . write ( ( 'a' * 18 ) ) #NEWLINE# fp . close ( ) #NEWLINE# z = zipimport . zipimporter ( TESTMOD ) #NEWLINE# try : #NEWLINE# #INDENT# self . assertRaises ( TypeError , z . find_module , None ) #NEWLINE# self . assertRaises ( TypeError , z . load_module , None ) #NEWLINE# self . assertRaises ( TypeError , z . is_package , None ) #NEWLINE# self . assertRaises ( TypeError , z . get_code , None ) #NEWLINE# self . assertRaises ( TypeError , z . get_data , None ) #NEWLINE# self . assertRaises ( TypeError , z . get_source , None ) #NEWLINE# error = zipimport . ZipImportError #NEWLINE# self . assertEqual ( z . find_module ( 'abc' ) , None ) #NEWLINE# self . assertRaises ( error , z . load_module , 'abc' ) #NEWLINE# self . assertRaises ( error , z . get_code , 'abc' ) #NEWLINE# self . assertRaises ( IOError , z . get_data , 'abc' ) #NEWLINE# self . assertRaises ( error , z . get_source , 'abc' ) #NEWLINE# self . assertRaises ( error , z . is_package , 'abc' ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# zipimport . _zip_directory_cache . clear ( )