Author: bugman Date: Mon Nov 26 19:39:51 2007 New Revision: 4062 URL: http://svn.gna.org/viewcvs/relax?rev=4062&view=rev Log: Added the framework for the arg unit tests of the relax_data user functions. Added: 1.3/test_suite/unit_tests/_prompt/test_relax_data.py - copied, changed from r4060, 1.3/test_suite/unit_tests/_prompt/test_diffusion_tensor.py Copied: 1.3/test_suite/unit_tests/_prompt/test_relax_data.py (from r4060, 1.3/test_suite/unit_tests/_prompt/test_diffusion_tensor.py) URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/unit_tests/_prompt/test_relax_data.py?p2=1.3/test_suite/unit_tests/_prompt/test_relax_data.py&p1=1.3/test_suite/unit_tests/_prompt/test_diffusion_tensor.py&r1=4060&r2=4062&rev=4062&view=diff ============================================================================== --- 1.3/test_suite/unit_tests/_prompt/test_diffusion_tensor.py (original) +++ 1.3/test_suite/unit_tests/_prompt/test_relax_data.py Mon Nov 26 19:39:51 2007 @@ -25,152 +25,19 @@ # relax module imports. from data import Data as relax_data_store -from prompt.diffusion_tensor import Diffusion_tensor -from relax_errors import RelaxError, RelaxBinError, RelaxFloatError, RelaxIntError, RelaxNoneStrError, RelaxNumTupleError, RelaxStrError -from test_suite.unit_tests.diffusion_tensor_testing_base import Diffusion_tensor_base_class +from prompt.relax_data import Relax_data +from relax_errors import RelaxError +from test_suite.unit_tests.relax_data_testing_base import Relax_data_base_class # Unit test imports. from data_types import DATA_TYPES import fake_relax -class Test_diffusion_tensor(Diffusion_tensor_base_class, TestCase): - """Unit tests for the functions of the 'prompt.diffusion_tensor' module.""" +class Test_relax_data(Relax_data_base_class, TestCase): + """Unit tests for the functions of the 'prompt.relax_data' module.""" # Instantiate the user function class. - diffusion_tensor_fns = Diffusion_tensor(fake_relax.fake_instance()) + relax_data_fns = Relax_data(fake_relax.fake_instance()) - def test_copy_argfail_pipe_from(self): - """The pipe_from arg test of the diffusion_tensor.copy() user function.""" - - # Loop over the data types. - for data in DATA_TYPES: - # Catch the None and str arguments, and skip them. - if data[0] == 'None' or data[0] == 'str': - continue - - # The argument test. - self.assertRaises(RelaxNoneStrError, self.diffusion_tensor_fns.copy, pipe_from=data[1]) - - - def test_copy_argfail_pipe_to(self): - """The pipe_to arg test of the diffusion_tensor.copy() user function.""" - - # Loop over the data types. - for data in DATA_TYPES: - # Catch the None and str arguments, and skip them. - if data[0] == 'None' or data[0] == 'str': - continue - - # The argument test. - self.assertRaises(RelaxNoneStrError, self.diffusion_tensor_fns.copy, pipe_to=data[1]) - - - def test_copy_argfail_both_pipes(self): - """The pipe_from and pipe_to arg test of the diffusion_tensor.copy() user function.""" - - # Test that both cannot be None (the default)! - self.assertRaises(RelaxError, self.diffusion_tensor_fns.copy) - - - def test_init_argfail_params(self): - """Proper failure of the diffusion_tensor.init() user function for the params argument.""" - - # Loop over the data types. - for data in DATA_TYPES: - # Catch a single float, int, or bin, and skip them. - if data[0] == 'int' or data[0] == 'bin' or data[0] == 'float': - continue - - # Catch the tuple arguments. - if data[0] == 'tuple' or data[0] == 'float tuple': - # Incorrect tuple length. - if len(data[1]) != 4 and len(data[1]) != 6: - self.assertRaises(RelaxError, self.diffusion_tensor_fns.init, params=data[1]) - - # Must be a number. - elif data[0] != 'float tuple': - self.assertRaises(RelaxNumTupleError, self.diffusion_tensor_fns.init, params=data[1]) - - # The argument test. - else: - self.assertRaises(RelaxNumTupleError, self.diffusion_tensor_fns.init, params=data[1]) - - - def test_init_argfail_time_scale(self): - """The time_scale arg test of the diffusion_tensor.init() user function.""" - - # Loop over the data types. - for data in DATA_TYPES: - # Catch the float argument, and skip it. - if data[0] == 'float': - continue - - # The argument test. - self.assertRaises(RelaxFloatError, self.diffusion_tensor_fns.init, params=1e-9, time_scale=data[1]) - - - def test_init_argfail_d_scale(self): - """The d_scale arg test of the diffusion_tensor.init() user function.""" - - # Loop over the data types. - for data in DATA_TYPES: - # Catch the float argument, and skip it. - if data[0] == 'float': - continue - - # The argument test. - self.assertRaises(RelaxFloatError, self.diffusion_tensor_fns.init, params=1e-9, d_scale=data[1]) - - - def test_init_argfail_angle_units(self): - """The angle_units arg test of the diffusion_tensor.init() user function.""" - - # Loop over the data types. - for data in DATA_TYPES: - # Catch the str argument, and skip it. - if data[0] == 'str': - continue - - # The argument test. - self.assertRaises(RelaxStrError, self.diffusion_tensor_fns.init, params=1e-9, angle_units=data[1]) - - - def test_init_argfail_param_types(self): - """The param_types arg test of the diffusion_tensor.init() user function.""" - - # Loop over the data types. - for data in DATA_TYPES: - # Catch the int and bin arguments, and skip them. - if data[0] == 'int' or data[0] == 'bin': - continue - - # The argument test. - self.assertRaises(RelaxIntError, self.diffusion_tensor_fns.init, params=1e-9, param_types=data[1]) - - - def test_init_argfail_spheroid_type(self): - """The spheroid_type arg test of the diffusion_tensor.init() user function.""" - - # Loop over the data types. - for data in DATA_TYPES: - # Catch the None and str arguments, and skip them. - if data[0] == 'None' or data[0] == 'str': - continue - - # The argument test. - self.assertRaises(RelaxNoneStrError, self.diffusion_tensor_fns.init, params=1e-9, spheroid_type=data[1]) - - - def test_init_argfail_fixed(self): - """The fixed arg test of the diffusion_tensor.init() user function.""" - - # Loop over the data types. - for data in DATA_TYPES: - # Catch the bin arguments, and skip them. - if data[0] == 'bin': - continue - - # The argument test. - self.assertRaises(RelaxBinError, self.diffusion_tensor_fns.init, params=1e-9, fixed=data[1])