def test_write_parameters_filename_default(self): params = FFD(n_control_points=[3, 2, 2]) params.write_parameters() outfilename = 'parameters.prm' outfilename_expected = 'tests/test_datasets/parameters_default.prm' self.assertTrue(filecmp.cmp(outfilename, outfilename_expected)) os.remove(outfilename)
def test_write_parameters(self): params = FFD(n_control_points=[3, 2, 2]) params.read_parameters('tests/test_datasets/parameters_sphere.prm') outfilename = 'tests/test_datasets/parameters_sphere_out.prm' outfilename_expected = 'tests/test_datasets/parameters_sphere_out_true.prm' params.write_parameters(outfilename) self.assertTrue(filecmp.cmp(outfilename, outfilename_expected)) os.remove(outfilename)
def test_write_parameters_filename_default_existance(self): params = FFD(n_control_points=[3, 2, 2]) params.write_parameters() outfilename = 'parameters.prm' assert os.path.isfile(outfilename) os.remove(outfilename)
def test_write_parameters_failing_filename_type(self): params = FFD(n_control_points=[3, 2, 2]) with self.assertRaises(TypeError): params.write_parameters(5)