Author: bugman Date: Sun May 4 15:49:31 2008 New Revision: 6099 URL: http://svn.gna.org/viewcvs/relax?rev=6099&view=rev Log: Re-added tests for disallowed residue and spin selections. Modified: branches/mol_res_spin_module_rename/generic_fns/mol_res_spin.py Modified: branches/mol_res_spin_module_rename/generic_fns/mol_res_spin.py URL: http://svn.gna.org/viewcvs/relax/branches/mol_res_spin_module_rename/generic_fns/mol_res_spin.py?rev=6099&r1=6098&r2=6099&view=diff ============================================================================== --- branches/mol_res_spin_module_rename/generic_fns/mol_res_spin.py (original) +++ branches/mol_res_spin_module_rename/generic_fns/mol_res_spin.py Sun May 4 15:49:31 2008 @@ -1132,6 +1132,13 @@ # Get the single molecule data container. mol = return_molecule(mol_id) + # Disallow residue and spin selections. + select_obj = Selection(mol_id) + if select_obj.has_residues(): + raise RelaxResSelectDisallowError + if select_obj.has_spins(): + raise RelaxSpinSelectDisallowError + # Name the molecule is there is a single match. if mol: mol.name = name @@ -1146,6 +1153,11 @@ @type name: str """ + # Disallow spin selections. + select_obj = Selection(res_id) + if select_obj.has_spins(): + raise RelaxSpinSelectDisallowError + # Rename the matching residues. for res in residue_loop(res_id): res.name = name @@ -1174,7 +1186,7 @@ @type number: int """ - # Catch multiple renumberings! + # Catch multiple numberings! i = 0 for res in residue_loop(res_id): i = i + 1 @@ -1182,6 +1194,11 @@ # Fail if multiple residues are numbered. if i > 1: raise RelaxError, "The numbering of multiple residues is disallowed, each residue requires a unique number." + + # Disallow spin selections. + select_obj = Selection(res_id) + if select_obj.has_spins(): + raise RelaxSpinSelectDisallowError # Rename the residue. for res in residue_loop(res_id):