Author: bugman Date: Mon Nov 26 19:53:12 2007 New Revision: 4063 URL: http://svn.gna.org/viewcvs/relax?rev=4063&view=rev Log: Added 13 unit tests for the args of the relax_data.read() user function. Modified: 1.3/test_suite/unit_tests/_prompt/test_relax_data.py Modified: 1.3/test_suite/unit_tests/_prompt/test_relax_data.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/unit_tests/_prompt/test_relax_data.py?rev=4063&r1=4062&r2=4063&view=diff ============================================================================== --- 1.3/test_suite/unit_tests/_prompt/test_relax_data.py (original) +++ 1.3/test_suite/unit_tests/_prompt/test_relax_data.py Mon Nov 26 19:53:12 2007 @@ -26,7 +26,7 @@ # relax module imports. from data import Data as relax_data_store from prompt.relax_data import Relax_data -from relax_errors import RelaxError +from relax_errors import RelaxError, RelaxFloatError, RelaxIntError, RelaxNoneIntError, RelaxNoneStrError, RelaxStrError from test_suite.unit_tests.relax_data_testing_base import Relax_data_base_class # Unit test imports. @@ -41,3 +41,170 @@ relax_data_fns = Relax_data(fake_relax.fake_instance()) + def test_read_argfail_ri_label(self): + """The ri_label arg test of the relax_data.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.relax_data_fns.read, ri_label=data[1]) + + + def test_read_argfail_frq_label(self): + """The frq_label arg test of the relax_data.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.relax_data_fns.read, frq_label=data[1]) + + + def test_read_argfail_frq(self): + """The frq arg test of the relax_data.read() 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.relax_data_fns.read, frq=data[1]) + + + def test_read_argfail_file(self): + """The file arg test of the relax_data.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.relax_data_fns.read, file=data[1]) + + + def test_read_argfail_dir(self): + """The dir arg test of the relax_data.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.relax_data_fns.read, dir=data[1]) + + + def test_read_argfail_mol_name_col(self): + """The mol_name_col arg test of the relax_data.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.relax_data_fns.read, mol_name_col=data[1]) + + + def test_read_argfail_res_num_col(self): + """The res_num_col arg test of the relax_data.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.relax_data_fns.read, res_num_col=data[1]) + + + def test_read_argfail_res_name_col(self): + """The res_name_col arg test of the relax_data.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.relax_data_fns.read, res_name_col=data[1]) + + + def test_read_argfail_spin_num_col(self): + """The spin_num_col arg test of the relax_data.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.relax_data_fns.read, spin_num_col=data[1]) + + + def test_read_argfail_spin_name_col(self): + """The spin_name_col arg test of the relax_data.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.relax_data_fns.read, spin_name_col=data[1]) + + + def test_read_argfail_data_col(self): + """The data_col arg test of the relax_data.read() 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.relax_data_fns.read, data_col=data[1]) + + + def test_read_argfail_error_col(self): + """The error_col arg test of the relax_data.read() 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.relax_data_fns.read, error_col=data[1]) + + + def test_read_argfail_sep(self): + """The sep arg test of the relax_data.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.relax_data_fns.read, sep=data[1])