#NEWLINE# def test_file_io( ) : #NEWLINE# #INDENT# data = bytearray ( list ( range ( 36 ) ) ) #NEWLINE# supernested_test = b . parse ( data , deeply_nested_struct ) #NEWLINE# ( handle , file_path ) = tempfile . mkstemp ( ) #NEWLINE# try : #NEWLINE# #INDENT# b . write ( supernested_test , deeply_nested_struct , filename = file_path ) #NEWLINE# with open ( file_path , 'rb' ) as fp : #NEWLINE# #INDENT# supernested_test_from_file = b . parse ( fp , deeply_nested_struct ) #NEWLINE# #UNINDENT# for ( i , j , k ) in itertools . product ( range ( 3 ) , range ( 3 ) , range ( 3 ) ) : #NEWLINE# #INDENT# assert_equal ( supernested_test_from_file . ubermatrix [ i ] . matrix [ j ] [ k ] , supernested_test . ubermatrix [ i ] . matrix [ j ] [ k ] ) #NEWLINE# #UNINDENT# #UNINDENT# finally : #NEWLINE# #INDENT# os . close ( handle ) #NEWLINE# os . unlink ( file_path )