Package test_suite :: Package system_tests :: Module load_spins
[hide private]
[frames] | no frames]

Source Code for Module test_suite.system_tests.load_spins

 1  ############################################################################### 
 2  #                                                                             # 
 3  # Copyright (C) 2008-2011 Edward d'Auvergne                                   # 
 4  #                                                                             # 
 5  # This file is part of the program relax.                                     # 
 6  #                                                                             # 
 7  # relax is free software; you can redistribute it and/or modify               # 
 8  # it under the terms of the GNU General Public License as published by        # 
 9  # the Free Software Foundation; either version 2 of the License, or           # 
10  # (at your option) any later version.                                         # 
11  #                                                                             # 
12  # relax is distributed in the hope that it will be useful,                    # 
13  # but WITHOUT ANY WARRANTY; without even the implied warranty of              # 
14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # 
15  # GNU General Public License for more details.                                # 
16  #                                                                             # 
17  # You should have received a copy of the GNU General Public License           # 
18  # along with relax; if not, write to the Free Software                        # 
19  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   # 
20  #                                                                             # 
21  ############################################################################### 
22   
23  # Python module imports. 
24  from os import sep 
25  import sys 
26   
27  # relax module imports. 
28  from base_classes import SystemTestCase 
29  from data import Relax_data_store; ds = Relax_data_store() 
30  from status import Status; status = Status() 
31   
32   
33 -class Load_spins(SystemTestCase):
34 """TestCase class for the loading of spins into the molecule/residue/spin data structure.""" 35
36 - def setUp(self):
37 """Set up for all the functional tests.""" 38 39 # Create the data pipe. 40 self.interpreter.pipe.create('mf', 'mf')
41 42
44 """Test the loading of spins from a small molecule using the Scientific Python PDB data object.""" 45 46 # Execute a relax script. 47 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'load_spins_from_small_molecule.py') 48 49 # Test the molecule and residue data. 50 self.assertEqual(len(cdp.mol), 1) 51 self.assertEqual(cdp.mol[0].name, 'gromacs_mol1') 52 self.assertEqual(len(cdp.mol[0].res), 1) 53 self.assertEqual(cdp.mol[0].res[0].num, 1) 54 self.assertEqual(cdp.mol[0].res[0].name, 'PYR') 55 56 # Spin info. 57 nums = [4, 6, 8, 10, 33, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 15, 16, 28, 30] 58 names = ['H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'H7', 'H8', 'H9', 'H10', 'H11', 'H12', 'H13', 'H14', 'H15', 'H16', 'H17', 'H18', 'H19', 'H20', 'H21', 'H22', 'H23', 'H24', 'H25', 'H26', 'H27', 'H28', 'C5', 'C6', 'C19', 'C23'] 59 elements = ['H']*28 + ['C']*4 60 61 # Loop over the spin containers, testing each. 62 self.assertEqual(len(cdp.mol[0].res[0].spin), 32) 63 for i in xrange(len(cdp.mol[0].res[0].spin)): 64 self.assertEqual(cdp.mol[0].res[0].spin[i].num, nums[i]) 65 self.assertEqual(cdp.mol[0].res[0].spin[i].name, names[i]) 66 self.assertEqual(cdp.mol[0].res[0].spin[i].element, elements[i]) 67 self.assert_(hasattr(cdp.mol[0].res[0].spin[i], 'pos'))
68