Author: bugman Date: Mon Jan 7 13:31:37 2008 New Revision: 4414 URL: http://svn.gna.org/viewcvs/relax?rev=4414&view=rev Log: Wrote 6 unit tests for the rest of the minimise() user function keyword arguments.
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=4414&r1=4413&r2=4414&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 13:31:37 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 RelaxError, RelaxBinError, RelaxIntError, RelaxIntListIntError, RelaxListError, RelaxListNumError, RelaxNoneError, RelaxStrError +from relax_errors import RelaxError, RelaxBinError, RelaxIntError, RelaxIntListIntError, RelaxListError, RelaxListNumError, RelaxNoneError, RelaxNoneNumError, RelaxStrError from test_suite.unit_tests.minimisation_testing_base import Minimisation_base_class # Unit test imports. @@ -154,3 +154,83 @@ for data in DATA_TYPES: # The argument test. self.assertRaises(RelaxError, self.minimisation_fns.minimise, 'Newton', step_tol=data[1]) + + + def test_minimise_argfail_func_tol(self): + """The func_tol arg test of the minimise() user function.""" + + # Loop over the data types. + for data in DATA_TYPES: + # Catch the None, float, bin, and int arguments, and skip them. + if data[0] == 'None' or data[0] == 'float' or data[0] == 'bin' or data[0] == 'int': + continue + + # The argument test. + self.assertRaises(RelaxNoneNumError, self.minimisation_fns.minimise, 'Newton', func_tol=data[1]) + + + def test_minimise_argfail_grad_tol(self): + """The grad_tol arg test of the minimise() user function.""" + + # Loop over the data types. + for data in DATA_TYPES: + # Catch the None, float, bin, and int arguments, and skip them. + if data[0] == 'None' or data[0] == 'float' or data[0] == 'bin' or data[0] == 'int': + continue + + # The argument test. + self.assertRaises(RelaxNoneNumError, self.minimisation_fns.minimise, 'Newton', grad_tol=data[1]) + + + def test_minimise_argfail_max_iterations(self): + """The max_iterations arg test of the minimise() user function.""" + + # Loop over the data types. + for data in DATA_TYPES: + # Catch the bin and int arguments, and skip them. + if data[0] == 'bin' or data[0] == 'int': + continue + + # The argument test. + self.assertRaises(RelaxIntError, self.minimisation_fns.minimise, 'Newton', max_iterations=data[1]) + + + def test_minimise_argfail_constraints(self): + """The constraints arg test of the minimise() 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.minimisation_fns.minimise, 'Newton', constraints=data[1]) + + + def test_minimise_argfail_scaling(self): + """The scaling arg test of the minimise() 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.minimisation_fns.minimise, 'Newton', scaling=data[1]) + + + def test_minimise_argfail_print_flag(self): + """The print_flag arg test of the minimise() user function.""" + + # Loop over the data types. + for data in DATA_TYPES: + # Catch the bin and int arguments, and skip them. + if data[0] == 'bin' or data[0] == 'int': + continue + + # The argument test. + self.assertRaises(RelaxIntError, self.minimisation_fns.minimise, 'Newton', print_flag=data[1]) + + _______________________________________________ relax (http://nmr-relax.com) This is the relax-commits mailing list relax-commits@gna.org To unsubscribe from this list, get a password reminder, or change your subscription options, visit the list information page at https://mail.gna.org/listinfo/relax-commits