Author: bugman Date: Sun Nov 4 11:55:51 2007 New Revision: 3394 URL: http://svn.gna.org/viewcvs/relax?rev=3394&view=rev Log: Added a test for the failure of the generic_fns.selection.return_residue() function. This tests the failure of asking for a non-existent data pipe and the function has been fixed to fail appropriately. Modified: 1.3/generic_fns/selection.py 1.3/test_suite/unit_tests/generic_fns/test_selection.py Modified: 1.3/generic_fns/selection.py URL: http://svn.gna.org/viewcvs/relax/1.3/generic_fns/selection.py?rev=3394&r1=3393&r2=3394&view=diff ============================================================================== --- 1.3/generic_fns/selection.py (original) +++ 1.3/generic_fns/selection.py Sun Nov 4 11:55:51 2007 @@ -507,6 +507,10 @@ if pipe == None: pipe = relax_data_store.current_pipe + # Test that the data pipe exists. + if pipe not in relax_data_store.keys(): + raise RelaxNoRunError, pipe + # Parse the selection string. select_obj = Selection(selection) Modified: 1.3/test_suite/unit_tests/generic_fns/test_selection.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/unit_tests/generic_fns/test_selection.py?rev=3394&r1=3393&r2=3394&view=diff ============================================================================== --- 1.3/test_suite/unit_tests/generic_fns/test_selection.py (original) +++ 1.3/test_suite/unit_tests/generic_fns/test_selection.py Sun Nov 4 11:55:51 2007 @@ -26,7 +26,7 @@ # relax module imports. from data import Data as relax_data_store from generic_fns import selection -from relax_errors import RelaxError +from relax_errors import RelaxError, RelaxNoRunError class Test_selection(TestCase): @@ -304,6 +304,16 @@ # Test loop length. self.assertEqual(i, 5) + + + def test_return_residue_pipe_fail(self): + """Test the failure of the function for returning the desired residue data container. + + The function tested is generic_fns.selection.return_residue(). + """ + + # Try to get a residue from a missing data pipe. + self.assertRaises(RelaxNoRunError, selection.return_residue, selection=':2', pipe='new') def test_reverse(self):