#NEWLINE# def test_direct_write_and_read_into_file( self ) : #NEWLINE# #INDENT# blob = self . bucket . blob ( 'MyBuffer' ) #NEWLINE# file_contents = b'Hello World' #NEWLINE# blob . upload_from_string ( file_contents ) #NEWLINE# self . case_blobs_to_delete . append ( blob ) #NEWLINE# same_blob = self . bucket . blob ( 'MyBuffer' ) #NEWLINE# same_blob . reload ( ) #NEWLINE# temp_filename = tempfile . mktemp ( ) #NEWLINE# with open ( temp_filename , 'wb' ) as file_obj : #NEWLINE# #INDENT# same_blob . download_to_file ( file_obj ) #NEWLINE# #UNINDENT# with open ( temp_filename , 'rb' ) as file_obj : #NEWLINE# #INDENT# stored_contents = file_obj . read ( ) #NEWLINE# #UNINDENT# self . assertEqual ( file_contents , stored_contents )