#NEWLINE# @ patch ( 'menpo.io.output.landmark.json.dump' ) #NEWLINE# @ patch ( 'menpo.io.output.base.Path.exists' ) #NEWLINE# @ patch ( '{}.open' . format ( __name__ ) , create = True ) #NEWLINE# def test_export_landmark_ljson_3d( mock_open , exists , json_dump ) : #NEWLINE# #INDENT# exists . return_value = False #NEWLINE# fake_path = '/fake/fake3d.ljson' #NEWLINE# test3d_lg = test_lg . copy ( ) #NEWLINE# fake_z_points = np . random . random ( test3d_lg . lms . points . shape [ 0 ] ) #NEWLINE# test3d_lg . lms . points = np . concatenate ( [ test3d_lg . lms . points , fake_z_points [ ( ... , None ) ] ] , axis = ( - 1 ) ) #NEWLINE# with open ( exists ) as f : #NEWLINE# #INDENT# type ( f ) . name = PropertyMock ( return_value = fake_path ) #NEWLINE# mio . export_landmark_file ( test3d_lg , f , extension = 'ljson' ) #NEWLINE# #UNINDENT# assert ( json_dump . call_count == 1 ) #NEWLINE# json_points = np . array ( json_dump . call_args [ 0 ] [ 0 ] [ 'landmarks' ] [ 'points' ] ) #NEWLINE# assert_allclose ( json_points [ : , ( - 1 ) ] , fake_z_points )