Author: bugman Date: Sun Apr 20 20:30:44 2008 New Revision: 5874 URL: http://svn.gna.org/viewcvs/relax?rev=5874&view=rev Log: Wrote 6 unit tests for the currently non-existent Selection.contains_res() method. 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=5874&r1=5873&r2=5874&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 Apr 20 20:30:44 2008 @@ -230,6 +230,66 @@ self.assert_(obj.contains_mol()) + def test_Selection_contains_res1(self): + """The Selection object "#Ap4Aase:Glu | #RNA@C8" contains the res 'Glu'.""" + + # The Selection object. + obj = selection.Selection("#Ap4Aase:Glu | #RNA@C8") + + # Check if the molecule is in the selection. + self.assert_(obj.contains_res('Glu')) + + + def test_Selection_contains_res2(self): + """The Selection object "#Ap4Aase:Glu | #RNA@C8" contains the res 'Glu' 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('Glu', 'Ap4Aase')) + + + def test_Selection_contains_res3(self): + """The Selection object "#Ap4Aase:Glu & #RNA@C8" does not contain the res 'Glu'.""" + + # The Selection object. + obj = selection.Selection("#Ap4Aase:Glu & #RNA@C8") + + # Check if the molecule is in the selection. + self.assert_(not obj.contains_res('Glu')) + + + def test_Selection_contains_res4(self): + """The Selection object "#Ap4Aase:Glu | #RNA@C8" does not contain the res 'Ala'.""" + + # The Selection object. + obj = selection.Selection("#Ap4Aase:Glu | #RNA@C8") + + # Check if the molecule is in the selection. + self.assert_(not obj.contains_res('Ala')) + + + def test_Selection_contains_res5(self): + """The Selection object "#Ap4Aase:Glu | #RNA:14@C8" does not contain the res None.""" + + # The Selection object. + obj = selection.Selection("#Ap4Aase:Glu | #RNA:14@C8") + + # Check if the molecule is in the selection. + self.assert_(not obj.contains_res()) + + + def test_Selection_contains_res6(self): + """The Selection object "#Ap4Aase" does contains the res None.""" + + # The Selection object. + obj = selection.Selection("#Ap4Aase") + + # Check if the molecule is in the selection. + self.assert_(obj.contains_res()) + + def test_Selection_full_spin_id(self): """Test the Selection object for the single spin identifier '#Ap4Aase:2&:Glu@63&@NH'."""