Author: bugman Date: Wed Apr 23 23:33:08 2008 New Revision: 5961 URL: http://svn.gna.org/viewcvs/relax?rev=5961&view=rev Log: Wrote 6 unit tests for the Selection.contains_*() methods when regular expression is passed in. 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=5961&r1=5960&r2=5961&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 Wed Apr 23 23:33:08 2008 @@ -230,6 +230,26 @@ self.assert_(obj.contains_mol()) + def test_Selection_contains_mol_re1(self): + """The Selection object "#Ap4Aase:Glu | #RNA@C8" contains the molecule 'R*'.""" + + # The Selection object. + obj = selection.Selection("#Ap4Aase:Glu | #RNA@C8") + + # Check if the molecule is in the selection. + self.assert_(obj.contains_mol('R*')) + + + def test_Selection_contains_mol_re2(self): + """The Selection object "#Ap4Aase:Glu | #RNA@C8" contains the molecule '*R*'.""" + + # The Selection object. + obj = selection.Selection("#Ap4Aase:Glu | #RNA@C8") + + # Check if the molecule is in the selection. + self.assert_(obj.contains_mol('*R*')) + + def test_Selection_contains_res1(self): """The Selection object "#Ap4Aase:Glu | #RNA@C8" does not contain the res 'Glu' (without the mol name).""" @@ -300,6 +320,26 @@ self.assert_(not obj.contains_res(mol='RNA')) + def test_Selection_contains_res_re1(self): + """The Selection object "#Ap4Aase:Glu | #RNA@C8" contains the res 'G*' of the mol 'Ap4Aase'.""" + + # The Selection object. + obj = selection.Selection("#Ap4Aase:Glu | #RNA@C8") + + # Check if the molecule is in the selection. + self.assert_(obj.contains_res(res_name='G*', mol='Ap4Aase')) + + + def test_Selection_contains_res_re2(self): + """The Selection object "#Ap4Aase:Glu | #RNA@C8" contains the res '*G*' of the mol 'Ap4Aase'.""" + + # The Selection object. + obj = selection.Selection("#Ap4Aase:Glu | #RNA@C8") + + # Check if the molecule is in the selection. + self.assert_(obj.contains_res(res_name='*G*', mol='Ap4Aase')) + + def test_Selection_contains_spin1(self): """The Selection object "#Ap4Aase:Glu | #RNA@C8" does not contain the spin 'C8' (without the mol name).""" @@ -368,6 +408,26 @@ # Check if the molecule is in the selection. self.assert_(not obj.contains_spin(mol='RNA')) + + + def test_Selection_contains_spin_re1(self): + """The Selection object "#Ap4Aase:Glu | #RNA@C8" contains the spin 'C*' of the mol 'RNA'.""" + + # The Selection object. + obj = selection.Selection("#Ap4Aase:Glu | #RNA@C8") + + # Check if the molecule is in the selection. + self.assert_(obj.contains_spin(spin_name='C*', mol='RNA')) + + + def test_Selection_contains_spin_re2(self): + """The Selection object "#Ap4Aase:Glu | #RNA@C8" contains the spin '*C*' of the mol 'RNA'.""" + + # The Selection object. + obj = selection.Selection("#Ap4Aase:Glu | #RNA@C8") + + # Check if the molecule is in the selection. + self.assert_(obj.contains_spin(spin_name='*C*', mol='RNA')) def test_Selection_full_spin_id(self):