Author: bugman Date: Sun Nov 4 19:56:29 2007 New Revision: 3446 URL: http://svn.gna.org/viewcvs/relax?rev=3446&view=rev Log: Added 2 unit tests for the failure of the generic_fns.molecule.rename() function. Modified: 1.3/test_suite/unit_tests/generic_fns/test_molecule.py Modified: 1.3/test_suite/unit_tests/generic_fns/test_molecule.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/unit_tests/generic_fns/test_molecule.py?rev=3446&r1=3445&r2=3446&view=diff ============================================================================== --- 1.3/test_suite/unit_tests/generic_fns/test_molecule.py (original) +++ 1.3/test_suite/unit_tests/generic_fns/test_molecule.py Sun Nov 4 19:56:29 2007 @@ -336,4 +336,27 @@ self.assertEqual(relax_data_store['orig'].mol[1].name, 'K') - + def test_rename_fail(self): + """Test the failure of renaming a molecule when a residue or spin id is given. + + The function tested is generic_fns.molecule.rename(). + """ + + # Try renaming using a spin id. + self.assertRaises(RelaxSpinSelectDisallowError, molecule.rename, mol_id='@111', new_name='K') + + # Try renaming using a residue id. + self.assertRaises(RelaxResSelectDisallowError, molecule.rename, mol_id=':1', new_name='K') + + + def test_rename_many_fail(self): + """Test the failure of the renaming of multiple molecules to the same name. + + The function used is generic_fns.molecule.rename(). + """ + + # Set up some data. + self.setup_data() + + # Test for the failure. + self.assertRaises(RelaxError, molecule.rename, mol_id='#Old mol,New mol', new_name='K')