mailr5878 - /1.3/test_suite/unit_tests/_generic_fns/_structure/test_scientific.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on April 20, 2008 - 21:25:
Author: bugman
Date: Sun Apr 20 21:24:59 2008
New Revision: 5878

URL: http://svn.gna.org/viewcvs/relax?rev=5878&view=rev
Log:
Wrote 3 unit tests for the Scientific_data.__residue_loop() method.


Modified:
    1.3/test_suite/unit_tests/_generic_fns/_structure/test_scientific.py

Modified: 1.3/test_suite/unit_tests/_generic_fns/_structure/test_scientific.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/test_suite/unit_tests/_generic_fns/_structure/test_scientific.py?rev=5878&r1=5877&r2=5878&view=diff
==============================================================================
--- 1.3/test_suite/unit_tests/_generic_fns/_structure/test_scientific.py 
(original)
+++ 1.3/test_suite/unit_tests/_generic_fns/_structure/test_scientific.py Sun 
Apr 20 21:24:59 2008
@@ -119,6 +119,69 @@
 
         # Test the number of molecules looped over.
         self.assertEqual(mol_count, 0)
+
+
+    def test___residue_loop(self):
+        """Test the private Scientific_data.__residue_loop() method."""
+
+        # Load the PDB file.
+        self.data.load_structures(self.test_pdb_path)
+
+        # Loop over the residues.
+        res_count = 0
+        for res, res_num, res_name in 
self.data._Scientific_data__residue_loop(self.data.structural_data[0].peptide_chains[0],
 None, 'protein'):
+            res_count = res_count + 1
+
+        # Test the number of residues looped over.
+        self.assertEqual(res_count, 12)
+
+        # Test the data of the last residue.
+        self.assertEqual(res_num, 12)
+        self.assertEqual(res_name, 'GLY')
+        self.assertEqual(len(res.atoms), 7)
+        self.assertEqual(res.atoms.keys(), ['C', 'H', 'CA', 'O', 'N', '1HA', 
'2HA'])
+
+
+    def test___residue_loop_selection(self):
+        """Test the private Scientific_data.__residue_loop() method with a 
selection object."""
+
+        # Load the PDB file.
+        self.data.load_structures(self.test_pdb_path)
+
+        # Create the selection object (which should match the residue name 
of None).
+        sel_obj = Selection('#Ap4Aase')
+
+        # Loop over the residues.
+        res_count = 0
+        for res, res_num, res_name in 
self.data._Scientific_data__residue_loop(self.data.structural_data[0].peptide_chains[0],
 None, 'protein', sel_obj):
+            res_count = res_count + 1
+
+        # Test the number of residues looped over.
+        self.assertEqual(res_count, 12)
+
+        # Test the data of the last residue.
+        self.assertEqual(res_num, 12)
+        self.assertEqual(res_name, 'GLY')
+        self.assertEqual(len(res.atoms), 7)
+        self.assertEqual(res.atoms.keys(), ['C', 'H', 'CA', 'O', 'N', '1HA', 
'2HA'])
+
+
+    def test___residue_loop_selection_no_match(self):
+        """Test the Scientific_data.__residue_loop() method with a 
non-matching selection object."""
+
+        # Load the PDB file.
+        self.data.load_structures(self.test_pdb_path)
+
+        # Create the non-matching selection object.
+        sel_obj = Selection(':XXX')
+
+        # Loop over the residues.
+        res_count = 0
+        for res, res_num, res_name in 
self.data._Scientific_data__residue_loop(self.data.structural_data[0].peptide_chains[0],
 None, 'protein', sel_obj):
+            res_count = res_count + 1
+
+        # Test the number of residues looped over.
+        self.assertEqual(res_count, 0)
 
 
     def test_atom_loop(self):




Related Messages


Powered by MHonArc, Updated Sun Apr 20 22:20:10 2008