#NEWLINE# @ patch ( 'menpo.io.output.base.landmark_types' ) #NEWLINE# @ patch ( 'menpo.io.output.base.Path.exists' ) #NEWLINE# @ patch ( '{}.open' . format ( __name__ ) , create = True ) #NEWLINE# def test_export_file_handle_file_exists_overwrite( mock_open , exists , landmark_types ) : #NEWLINE# #INDENT# exists . return_value = True #NEWLINE# with open ( fake_path ) as f : #NEWLINE# #INDENT# type ( f ) . name = PropertyMock ( return_value = fake_path ) #NEWLINE# mio . export_landmark_file ( test_lg , f , overwrite = True , extension = 'fake' ) #NEWLINE# #UNINDENT# landmark_types . __getitem__ . assert_called_with ( '.fake' ) #NEWLINE# export_function = landmark_types . __getitem__ . return_value #NEWLINE# assert ( export_function . call_count == 1 )