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

Source Code for Module test_suite.system_tests.consistency_tests

 1  ############################################################################### 
 2  #                                                                             # 
 3  # Copyright (C) 2006 Chris MacRaild                                           # 
 4  # Copyright (C) 2007-2008 Sebastien Morin                                     # 
 5  # Copyright (C) 2010-2012 Edward d'Auvergne                                   # 
 6  #                                                                             # 
 7  # This file is part of the program relax (http://www.nmr-relax.com).          # 
 8  #                                                                             # 
 9  # This program is free software: you can redistribute it and/or modify        # 
10  # it under the terms of the GNU General Public License as published by        # 
11  # the Free Software Foundation, either version 3 of the License, or           # 
12  # (at your option) any later version.                                         # 
13  #                                                                             # 
14  # This program is distributed in the hope that it will be useful,             # 
15  # but WITHOUT ANY WARRANTY; without even the implied warranty of              # 
16  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # 
17  # GNU General Public License for more details.                                # 
18  #                                                                             # 
19  # You should have received a copy of the GNU General Public License           # 
20  # along with this program.  If not, see <http://www.gnu.org/licenses/>.       # 
21  #                                                                             # 
22  ############################################################################### 
23   
24  # Python module imports. 
25  from os import sep 
26  import sys 
27   
28  # relax module imports. 
29  from data import Relax_data_store; ds = Relax_data_store() 
30  from generic_fns.mol_res_spin import residue_loop 
31  from physical_constants import N15_CSA 
32  from status import Status; status = Status() 
33  from test_suite.system_tests.base_classes import SystemTestCase 
34   
35   
36 -class Ct(SystemTestCase):
37 """Class for testing various aspects specific to consistency testing.""" 38 39
40 - def setUp(self):
41 """Set up for all the functional tests.""" 42 43 # Create the data pipe. 44 self.interpreter.pipe.create('ct', 'ct')
45 46
47 - def test_calc(self):
48 """The consistency testing calculation test.""" 49 50 # Execute the script. 51 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'consistency_tests_calc_test.py') 52 53 # Correct consistency functions values. 54 j0 = [4.0703318681008998e-09, 3.7739393907014834e-09] 55 f_eta = [0.20413244790407614, 0.18898977395296815] 56 f_r2 = [2.0482909381655862e-09, 1.8998154021753067e-09] 57 58 # Loop over residues. 59 index = 0 60 for res in residue_loop(): 61 # Residues -2 and -1 have data. 62 if res.num == -2 or res.num == -1: 63 self.assert_(res.spin[0].select) 64 self.assertAlmostEqual(res.spin[0].j0, j0[index]) 65 self.assertAlmostEqual(res.spin[0].f_eta, f_eta[index]) 66 self.assertAlmostEqual(res.spin[0].f_r2, f_r2[index]) 67 index = index + 1 68 69 # Other residues have insufficient data. 70 else: 71 self.assert_(not res.spin[0].select)
72 73
74 - def test_set_value(self):
75 """The user function value.set().""" 76 77 # Execute the script. 78 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'consistency_tests_set_value.py') 79 80 # Loop over residues. 81 for res in residue_loop(): 82 self.assertAlmostEqual(res.spin[0].csa, N15_CSA)
83 84
85 - def test_consistency(self):
86 """Test a complete consistency tests run using a script.""" 87 88 # Execute the script. 89 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'consistency_tests.py')
90