def test_iges_write_modified_tolerance(self): iges_handler = IgesHandler() mesh_points = iges_handler.parse('tests/test_datasets/test_pipe.iges') outfilename = 'tests/test_datasets/test_pipe_out.iges' iges_handler.write(mesh_points, outfilename, 1e-3) self.assertEqual(iges_handler.outfile, outfilename) self.addCleanup(os.remove, outfilename)
def test_iges_write_comparison_igs(self): iges_handler = IgesHandler() mesh_points = iges_handler.parse('tests/test_datasets/test_pipe.igs') mesh_points[0][0] = 2.2 mesh_points[5][1] = 4.3 mesh_points[9][2] = 0.5 mesh_points[12][0] = 7.2 mesh_points[16][1] = -1.2 mesh_points[31][2] = -3.6 outfilename = 'tests/test_datasets/test_pipe_out.igs' outfilename_expected = 'tests/test_datasets/test_pipe_out_true.igs' iges_handler.write(mesh_points, outfilename) mesh_points = iges_handler.parse(outfilename) mesh_points_expected = iges_handler.parse(outfilename_expected) np.testing.assert_array_almost_equal(mesh_points, mesh_points_expected) self.addCleanup(os.remove, outfilename)
def test_iges_write_failing_infile_instantiation(self): iges_handler = IgesHandler() mesh_points = np.zeros((20, 3)) with self.assertRaises(RuntimeError): iges_handler.write(mesh_points, 'tests/test_datasets/test_pipe_out.iges')
def test_iges_write_failing_check_extension(self): iges_handler = IgesHandler() mesh_points = iges_handler.parse('tests/test_datasets/test_pipe.iges') with self.assertRaises(ValueError): iges_handler.write(mesh_points, 'tests/test_datasets/test_square.stl')
def test_iges_write_failing_filename_type(self): iges_handler = IgesHandler() mesh_points = iges_handler.parse('tests/test_datasets/test_pipe.iges') with self.assertRaises(TypeError): iges_handler.write(mesh_points, -2)