Author: bugman Date: Sun Nov 25 17:05:46 2007 New Revision: 3915 URL: http://svn.gna.org/viewcvs/relax?rev=3915&view=rev Log: Implemented the test of diffusion_tensor.copy(), that both arguments cannot be None. A unit test for this has also been added. Modified: 1.3/prompt/diffusion_tensor.py 1.3/test_suite/unit_tests/_prompt/test_diffusion_tensor.py Modified: 1.3/prompt/diffusion_tensor.py URL: http://svn.gna.org/viewcvs/relax/1.3/prompt/diffusion_tensor.py?rev=3915&r1=3914&r2=3915&view=diff ============================================================================== --- 1.3/prompt/diffusion_tensor.py (original) +++ 1.3/prompt/diffusion_tensor.py Sun Nov 25 17:05:46 2007 @@ -20,8 +20,10 @@ # # ############################################################################### +# Python module imports. import sys +# relax module imports. import help from relax_errors import RelaxBinError, RelaxError, RelaxFloatError, RelaxIntError, RelaxNoneStrError, RelaxNumTupleError, RelaxStrError @@ -93,6 +95,10 @@ # The pipe_to argument. if pipe_to != None and type(pipe_to) != str: raise RelaxNoneStrError, ('pipe to', pipe_to) + + # Both pipe arguments cannot be None. + if pipe_from == None and pipe_to == None: + raise RelaxError, "The pipe_from and pipe_to arguments cannot both be set to None." # Execute the functional code. diffusion_tensor.copy(pipe_from=pipe_from, pipe_to=pipe_to) Modified: 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_diffusion_tensor.py?rev=3915&r1=3914&r2=3915&view=diff ============================================================================== --- 1.3/test_suite/unit_tests/_prompt/test_diffusion_tensor.py (original) +++ 1.3/test_suite/unit_tests/_prompt/test_diffusion_tensor.py Sun Nov 25 17:05:46 2007 @@ -26,7 +26,7 @@ # relax module imports. from data import Data as relax_data_store from prompt.diffusion_tensor import Diffusion_tensor -from relax_errors import RelaxBinError, RelaxFloatError, RelaxIntError, RelaxNoneStrError, RelaxNumTupleError, RelaxStrError +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 # Unit test imports. @@ -42,7 +42,7 @@ def test_copy_argfail_pipe_from(self): - """Proper failure of the diffusion_tensor.copy() user function for the pipe_from argument.""" + """The pipe_from arg test of the diffusion_tensor.copy() user function.""" # Loop over the data types. for data in DATA_TYPES: @@ -55,7 +55,7 @@ def test_copy_argfail_pipe_to(self): - """Proper failure of the diffusion_tensor.copy() user function for the pipe_to argument.""" + """The pipe_to arg test of the diffusion_tensor.copy() user function.""" # Loop over the data types. for data in DATA_TYPES: @@ -65,6 +65,13 @@ # 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):