#NEWLINE# def assert_obtains_file_contents( self , func , file_path , is_text_file ) : #NEWLINE# #INDENT# 'Asserts that ``func()`` obtains the contents of the given file.\n\n        :param callable func: Function to be called.\n        :param str file_path: Path to the file to be downloaded.\n        :param bool is_text_file: Is it a text file or a binary file?\n        ' #NEWLINE# self . conn . get_file . return_value = io . BytesIO ( b'data' ) #NEWLINE# output = func ( ) #NEWLINE# self . assertEqual ( output , ( 'data' if is_text_file else b'data' ) ) #NEWLINE# self . conn . get_file . assert_called_once_with ( file_path )