Author: bugman Date: Sun Nov 4 13:27:15 2007 New Revision: 3397 URL: http://svn.gna.org/viewcvs/relax?rev=3397&view=rev Log: Added two unit tests for the generic_fns.selection.return_single_residue_info() function. Modified: 1.3/test_suite/unit_tests/generic_fns/test_selection.py 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=3397&r1=3396&r2=3397&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 13:27:15 2007 @@ -374,6 +374,43 @@ self.assertRaises(RelaxNoRunError, selection.return_residue, selection=':2', pipe='new') + def test_return_single_residue_info(self): + """Test the function for returning the desired residue data container. + + The function tested is generic_fns.selection.return_single_residue_info(). + """ + + # Ask for a few residues. + res1 = selection.return_single_residue_info('1') + res2 = selection.return_single_residue_info('2,Glu') + res4 = selection.return_single_residue_info('Pro,4') + res5 = selection.return_single_residue_info('-5') + + # Test the data of residue 1. + self.assertEqual(res1, (1, None)) + + # Test the data of residue 2. + self.assertEqual(res2, (2, 'Glu')) + + # Test the data of residue 4. + self.assertEqual(res4, (4, 'Pro')) + + # Test the data of the RNA residue -5. + self.assertEqual(res5, (-5, None)) + + + def test_return_single_residue_info_fail(self): + """Test the failure of the function for returning the desired residue data container. + + The function tested is generic_fns.selection.return_single_residue_info(). + """ + + # Ask for a few residues. + self.assertRaises(RelaxError, selection.return_single_residue_info, '1,2') + self.assertRaises(RelaxError, selection.return_single_residue_info, '1,Glu,Pro') + self.assertRaises(RelaxError, selection.return_single_residue_info, '1,2,Glu,Pro') + + def test_reverse(self): """Test spin system selection reversal.