def test_wavefront():
 fname_mesh = load_data_file('orig/triceratops.obj.gz')
 fname_out = op.join(temp_dir, 'temp.obj')
 mesh1 = read_mesh(fname_mesh)
 assert_raises(IOError, read_mesh, 'foo.obj')
 assert_raises(ValueError, read_mesh, op.abspath(__file__))
 assert_raises(ValueError, write_mesh, fname_out, format='foo', *mesh1)
 write_mesh(fname_out, mesh1[0], mesh1[1], mesh1[2], mesh1[3])
 assert_raises(IOError, write_mesh, fname_out, *mesh1)
 write_mesh(fname_out, overwrite=True, *mesh1)
 mesh2 = read_mesh(fname_out)
 assert_equal(len(mesh1), len(mesh2))
 for (m1, m2) in zip(mesh1, mesh2):
  if (m1 is None):
   assert_equal(m2, None)
  else:
   assert_allclose(m1, m2, rtol=1e-05)
 assert_allclose(mesh1[2], _slow_calculate_normals(mesh1[0], mesh1[1]), rtol=1e-07, atol=1e-07)

def test_wavefront ( ) : fname_mesh = load_data_file ( 'orig/triceratops.obj.gz' ) fname_out = op . join ( temp_dir , 'temp.obj' ) mesh1 = read_mesh ( fname_mesh ) assert_raises ( IOError , read_mesh , 'foo.obj' ) assert_raises ( ValueError , read_mesh , op . abspath ( __file__ ) ) assert_raises ( ValueError , write_mesh , fname_out , format = 'foo' , * mesh1 ) write_mesh ( fname_out , mesh1 [ 0 ] , mesh1 [ 1 ] , mesh1 [ 2 ] , mesh1 [ 3 ] ) assert_raises ( IOError , write_mesh , fname_out , * mesh1 ) write_mesh ( fname_out , overwrite = True , * mesh1 ) mesh2 = read_mesh ( fname_out ) assert_equal ( len ( mesh1 ) , len ( mesh2 ) ) for ( m1 , m2 ) in zip ( mesh1 , mesh2 ) : if ( m1 is None ) : assert_equal ( m2 , None ) else : assert_allclose ( m1 , m2 , rtol = 1e-05 ) assert_allclose ( mesh1 [ 2 ] , _slow_calculate_normals ( mesh1 [ 0 ] , mesh1 [ 1 ] ) , rtol = 1e-07 , atol = 1e-07 )
test wavefront reader .