Author: bugman Date: Mon Jan 7 12:01:40 2008 New Revision: 4407 URL: http://svn.gna.org/viewcvs/relax?rev=4407&view=rev Log: Wrote a unit test for the arguments to the minimise() user function. This is for the variable argument list for the minimisation algorithm and its options. Modified: 1.3/test_suite/unit_tests/_prompt/test_minimisation.py Modified: 1.3/test_suite/unit_tests/_prompt/test_minimisation.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/unit_tests/_prompt/test_minimisation.py?rev=4407&r1=4406&r2=4407&view=diff ============================================================================== --- 1.3/test_suite/unit_tests/_prompt/test_minimisation.py (original) +++ 1.3/test_suite/unit_tests/_prompt/test_minimisation.py Mon Jan 7 12:01:40 2008 @@ -26,7 +26,7 @@ # relax module imports. from data import Data as relax_data_store from prompt.minimisation import Minimisation -from relax_errors import RelaxBinError, RelaxIntError, RelaxIntListIntError, RelaxListError, RelaxListNumError +from relax_errors import RelaxBinError, RelaxIntError, RelaxIntListIntError, RelaxListError, RelaxListNumError, RelaxNoneError, RelaxStrError from test_suite.unit_tests.minimisation_testing_base import Minimisation_base_class # Unit test imports. @@ -127,3 +127,58 @@ # The argument test. self.assertRaises(RelaxIntError, self.minimisation_fns.grid_search, print_flag=data[1]) + + + def test_minimise_argfail_args(self): + """The test of the arguments of the minimise() user function.""" + + # No arguments. + ############### + + # The argument test. + self.assertRaises(RelaxNoneError, self.minimisation_fns.minimise) + + + # 1 argument. + ############# + + # Loop over the data types. + for data in DATA_TYPES: + # Catch the str arguments, and skip them. + if data[0] == 'str': + continue + + # The argument test. + self.assertRaises(RelaxStrError, self.minimisation_fns.minimise, data[1]) + + + # 2 arguments. + ############## + + # Loop over the data types. + for data1 in DATA_TYPES: + # Loop over the data types. + for data2 in DATA_TYPES: + # Catch the str arguments, and skip them. + if data1[0] == 'str' and data2[0] == 'str': + continue + + # The argument test. + self.assertRaises(RelaxStrError, self.minimisation_fns.minimise, data1[1], data2[1]) + + + # 3 arguments. + ############## + + # Loop over the data types. + for data1 in DATA_TYPES: + # Loop over the data types. + for data2 in DATA_TYPES: + # Loop over the data types. + for data3 in DATA_TYPES: + # Catch the str arguments, and skip them. + if data1[0] == 'str' and data2[0] == 'str' and data3[0] == 'str': + continue + + # The argument test. + self.assertRaises(RelaxStrError, self.minimisation_fns.minimise, data1[1], data2[1], data3[1])