Author: bugman Date: Mon Apr 14 17:56:40 2008 New Revision: 5700 URL: http://svn.gna.org/viewcvs/relax?rev=5700&view=rev Log: Wrote a unit test for the Selection object for boolean '&' mol-res-spin selections. 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=5700&r1=5699&r2=5700&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 Mon Apr 14 17:56:40 2008 @@ -82,13 +82,43 @@ relax_data_store.__reset__() + def test_Selection_boolean_and(self): + """Test the Selection object for boolean '&' mol-res-spin selections.""" + + # The Selection object. + obj = selection.Selection("#Ap4Aase:4 & :Pro@Ca") + + # Test the union and intersection structure. + self.assertEqual(obj._union, None) + self.assertNotEqual(obj._intersect, None) + self.assertEqual(obj._intersect[0]._union, None) + self.assertEqual(obj._intersect[0]._intersect, None) + self.assertEqual(obj._intersect[1]._union, None) + self.assertEqual(obj._intersect[1]._intersect, None) + + # Test the molecule, residue, and spins structures of the highest level object. + self.assertEqual(obj.molecules, []) + self.assertEqual(obj.residues, []) + self.assertEqual(obj.spins, []) + + # Test the molecule, residue, and spins structures of the first intersection. + self.assertEqual(obj._intersect[0].molecules, ['Ap4Aase']) + self.assertEqual(obj._intersect[0].residues, [4]) + self.assertEqual(obj._intersect[0].spins, []) + + # Test the molecule, residue, and spins structures of the second intersection. + self.assertEqual(obj._intersect[1].molecules, []) + self.assertEqual(obj._intersect[1].residues, ['Pro']) + self.assertEqual(obj._intersect[1].spins, ['Ca']) + + def test_Selection_complex_boolean(self): """Test the Selection object for complex boolean mol-res-spin selections.""" - # The Selection object: + # The Selection object. obj = selection.Selection("#Ap4Aase:4 & :Pro | #RNA") - # Tests + # Tests. self.assertEqual(obj._intersect, None) self.assertNotEqual(obj._union, None)