Author: bugman Date: Wed May 7 14:52:39 2008 New Revision: 6112 URL: http://svn.gna.org/viewcvs/relax?rev=6112&view=rev Log: Added 9 arg unit tests for the deselect.read() user function. Modified: 1.3/test_suite/unit_tests/_prompt/test_deselect.py Modified: 1.3/test_suite/unit_tests/_prompt/test_deselect.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/unit_tests/_prompt/test_deselect.py?rev=6112&r1=6111&r2=6112&view=diff ============================================================================== --- 1.3/test_suite/unit_tests/_prompt/test_deselect.py (original) +++ 1.3/test_suite/unit_tests/_prompt/test_deselect.py Wed May 7 14:52:39 2008 @@ -24,7 +24,8 @@ from unittest import TestCase # relax module imports. -from prompt.relax_data import Relax_data +from prompt.deselect import Deselect +from relax_errors import RelaxBoolError, RelaxNoneIntError, RelaxNoneStrError, RelaxStrError # Unit test imports. from data_types import DATA_TYPES @@ -35,6 +36,121 @@ """Unit tests for the functions of the 'prompt.deselect' module.""" # Instantiate the user function class. - relax_data_fns = Relax_data(fake_relax.fake_instance()) + deselect_fns = Deselect(fake_relax.fake_instance()) + def test_read_argfail_file(self): + """The file arg test of the deselect.read() 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.deselect_fns.read, file=data[1]) + + + def test_read_argfail_dir(self): + """The dir arg test of the deselect.read() 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.deselect_fns.read, file='unresolved', dir=data[1]) + + + def test_read_argfail_mol_name_col(self): + """The mol_name_col arg test of the deselect.read() user function.""" + + # Loop over the data types. + for data in DATA_TYPES: + # Catch the None, int, and bin arguments, and skip them. + if data[0] == 'None' or data[0] == 'int' or data[0] == 'bin': + continue + + # The argument test. + self.assertRaises(RelaxNoneIntError, self.deselect_fns.read, file='unresolved', mol_name_col=data[1]) + + + def test_read_argfail_res_num_col(self): + """The res_num_col arg test of the deselect.read() user function.""" + + # Loop over the data types. + for data in DATA_TYPES: + # Catch the None, int, and bin arguments, and skip them. + if data[0] == 'None' or data[0] == 'int' or data[0] == 'bin': + continue + + # The argument test. + self.assertRaises(RelaxNoneIntError, self.deselect_fns.read, file='unresolved', res_num_col=data[1]) + + + def test_read_argfail_res_name_col(self): + """The res_name_col arg test of the deselect.read() user function.""" + + # Loop over the data types. + for data in DATA_TYPES: + # Catch the None, int, and bin arguments, and skip them. + if data[0] == 'None' or data[0] == 'int' or data[0] == 'bin': + continue + + # The argument test. + self.assertRaises(RelaxNoneIntError, self.deselect_fns.read, file='unresolved', res_name_col=data[1]) + + + def test_read_argfail_spin_num_col(self): + """The spin_num_col arg test of the deselect.read() user function.""" + + # Loop over the data types. + for data in DATA_TYPES: + # Catch the None, int, and bin arguments, and skip them. + if data[0] == 'None' or data[0] == 'int' or data[0] == 'bin': + continue + + # The argument test. + self.assertRaises(RelaxNoneIntError, self.deselect_fns.read, file='unresolved', spin_num_col=data[1]) + + + def test_read_argfail_spin_name_col(self): + """The spin_name_col arg test of the deselect.read() user function.""" + + # Loop over the data types. + for data in DATA_TYPES: + # Catch the None, int, and bin arguments, and skip them. + if data[0] == 'None' or data[0] == 'int' or data[0] == 'bin': + continue + + # The argument test. + self.assertRaises(RelaxNoneIntError, self.deselect_fns.read, file='unresolved', spin_name_col=data[1]) + + + def test_read_argfail_sep(self): + """The sep arg test of the deselect.read() 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.deselect_fns.read, file='unresolved', sep=data[1]) + + + def test_read_argfail_change_all(self): + """The change_all arg test of the deselect.read() user function.""" + + # Loop over the data types. + for data in DATA_TYPES: + # Catch the bool arguments, and skip them. + if data[0] == 'bool': + continue + + # The argument test. + self.assertRaises(RelaxBoolError, self.deselect_fns.read, file='unresolved', change_all=data[1])