mailr24797 - /trunk/test_suite/unit_tests/_pipe_control/test_mol_res_spin.py


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

Header


Content

Posted by edward on July 29, 2014 - 10:51:
Author: bugman
Date: Tue Jul 29 10:51:20 2014
New Revision: 24797

URL: http://svn.gna.org/viewcvs/relax?rev=24797&view=rev
Log:
Created a unit test for the pipe_control.mol_res_spin.format_info_full() 
function.

This comprehensive test covers all input argument combinations.


Modified:
    trunk/test_suite/unit_tests/_pipe_control/test_mol_res_spin.py

Modified: trunk/test_suite/unit_tests/_pipe_control/test_mol_res_spin.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/test_suite/unit_tests/_pipe_control/test_mol_res_spin.py?rev=24797&r1=24796&r2=24797&view=diff
==============================================================================
--- trunk/test_suite/unit_tests/_pipe_control/test_mol_res_spin.py      
(original)
+++ trunk/test_suite/unit_tests/_pipe_control/test_mol_res_spin.py      Tue 
Jul 29 10:51:20 2014
@@ -255,6 +255,66 @@
         self.assertRaises(RelaxNoPipeError, 
mol_res_spin.exists_mol_res_spin_data)
 
 
+    def test_format_info_full1(self):
+        """Test the format_info_full() function for all combinations of 
input."""
+
+        # The spin info and expected string - covering all possible 
combinations.
+        info = [
+            # 5 bits of info.
+            {'mol_name': 'Ubi', 'res_name': 'Ala', 'res_num': 10,   
'spin_name': 'N',  'spin_num': 200,  'string': "Molecule Ubi, residue Ala 10, 
spin N 200"},
+
+            # 4 bits of info.
+            {'mol_name': None,  'res_name': 'Ala', 'res_num': 10,   
'spin_name': 'N',  'spin_num': 200,  'string': "Residue Ala 10, spin N 200"},
+            {'mol_name': 'Ubi', 'res_name': None,  'res_num': 10,   
'spin_name': 'N',  'spin_num': 200,  'string': "Molecule Ubi, residue 10, 
spin N 200"},
+            {'mol_name': 'Ubi', 'res_name': 'Ala', 'res_num': None, 
'spin_name': 'N',  'spin_num': 200,  'string': "Molecule Ubi, residue Ala, 
spin N 200"},
+            {'mol_name': 'Ubi', 'res_name': 'Ala', 'res_num': 10,   
'spin_name': None, 'spin_num': 200,  'string': "Molecule Ubi, residue Ala 10, 
spin 200"},
+            {'mol_name': 'Ubi', 'res_name': 'Ala', 'res_num': 10,   
'spin_name': 'N',  'spin_num': None, 'string': "Molecule Ubi, residue Ala 10, 
spin N"},
+
+            # 3 bits of info.
+            {'mol_name': None,  'res_name': None,  'res_num': 10,   
'spin_name': 'N',  'spin_num': 200,  'string': "Residue 10, spin N 200"},
+            {'mol_name': None,  'res_name': 'Ala', 'res_num': None, 
'spin_name': 'N',  'spin_num': 200,  'string': "Residue Ala, spin N 200"},
+            {'mol_name': None,  'res_name': 'Ala', 'res_num': 10,   
'spin_name': None, 'spin_num': 200,  'string': "Residue Ala 10, spin 200"},
+            {'mol_name': None,  'res_name': 'Ala', 'res_num': 10,   
'spin_name': 'N',  'spin_num': None, 'string': "Residue Ala 10, spin N"},
+            {'mol_name': 'Ubi', 'res_name': None,  'res_num': None, 
'spin_name': 'N',  'spin_num': 200,  'string': "Molecule Ubi, spin N 200"},
+            {'mol_name': 'Ubi', 'res_name': None,  'res_num': 10,   
'spin_name': None, 'spin_num': 200,  'string': "Molecule Ubi, residue 10, 
spin 200"},
+            {'mol_name': 'Ubi', 'res_name': None,  'res_num': 10,   
'spin_name': 'N',  'spin_num': None, 'string': "Molecule Ubi, residue 10, 
spin N"},
+            {'mol_name': 'Ubi', 'res_name': 'Ala', 'res_num': None, 
'spin_name': None, 'spin_num': 200,  'string': "Molecule Ubi, residue Ala, 
spin 200"},
+            {'mol_name': 'Ubi', 'res_name': 'Ala', 'res_num': None, 
'spin_name': 'N',  'spin_num': None, 'string': "Molecule Ubi, residue Ala, 
spin N"},
+            {'mol_name': 'Ubi', 'res_name': 'Ala', 'res_num': 10,   
'spin_name': None, 'spin_num': None, 'string': "Molecule Ubi, residue Ala 
10"},
+
+            # 2 bits of info.
+            {'mol_name': None,  'res_name': None,  'res_num': None, 
'spin_name': 'N',  'spin_num': 200,  'string': "Spin N 200"},
+            {'mol_name': None,  'res_name': None,  'res_num': 10,   
'spin_name': None, 'spin_num': 200,  'string': "Residue 10, spin 200"},
+            {'mol_name': None,  'res_name': None,  'res_num': 10,   
'spin_name': 'N',  'spin_num': None, 'string': "Residue 10, spin N"},
+            {'mol_name': None,  'res_name': 'Ala', 'res_num': None, 
'spin_name': None, 'spin_num': 200,  'string': "Residue Ala, spin 200"},
+            {'mol_name': None,  'res_name': 'Ala', 'res_num': None, 
'spin_name': 'N',  'spin_num': None, 'string': "Residue Ala, spin N"},
+            {'mol_name': None,  'res_name': 'Ala', 'res_num': 10,   
'spin_name': None, 'spin_num': None, 'string': "Residue Ala 10"},
+            {'mol_name': 'Ubi', 'res_name': None,  'res_num': None, 
'spin_name': None, 'spin_num': 200,  'string': "Molecule Ubi, spin 200"},
+            {'mol_name': 'Ubi', 'res_name': None,  'res_num': None, 
'spin_name': 'N',  'spin_num': None, 'string': "Molecule Ubi, spin N"},
+            {'mol_name': 'Ubi', 'res_name': None,  'res_num': 10,   
'spin_name': None, 'spin_num': None, 'string': "Molecule Ubi, residue 10"},
+            {'mol_name': 'Ubi', 'res_name': 'Ala', 'res_num': None, 
'spin_name': None, 'spin_num': None, 'string': "Molecule Ubi, residue Ala"},
+
+            # 1 bit of info.
+            {'mol_name': None,  'res_name': None,  'res_num': None, 
'spin_name': None, 'spin_num': 200,  'string': "Spin 200"},
+            {'mol_name': None,  'res_name': None,  'res_num': None, 
'spin_name': 'N',  'spin_num': None, 'string': "Spin N"},
+            {'mol_name': None,  'res_name': None,  'res_num': 10,   
'spin_name': None, 'spin_num': None, 'string': "Residue 10"},
+            {'mol_name': None,  'res_name': 'Ala', 'res_num': None, 
'spin_name': None, 'spin_num': None, 'string': "Residue Ala"},
+            {'mol_name': 'Ubi', 'res_name': None,  'res_num': None, 
'spin_name': None, 'spin_num': None, 'string': "Molecule Ubi"},
+
+            # 0 bits of info.
+            {'mol_name': None,  'res_name': None,  'res_num': None, 
'spin_name': None, 'spin_num': None, 'string': ""},
+        ]
+
+        # Printout.
+        print("Checking %s combinations." % len(info))
+
+        # Create and check each string.
+        for i in range(len(info)):
+            print("    Checking %s" % info[i])
+            string = 
mol_res_spin.format_info_full(mol_name=info[i]['mol_name'], 
res_name=info[i]['res_name'], res_num=info[i]['res_num'], 
spin_name=info[i]['spin_name'], spin_num=info[i]['spin_num'])
+            self.assertEqual(string, info[i]['string'])
+
+
     def test_generate_spin_id_data_array1(self):
         """First test of the spin ID generation function.
 




Related Messages


Powered by MHonArc, Updated Tue Jul 29 11:40:02 2014