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

Source Code for Module test_suite.system_tests.value

 1  ############################################################################### 
 2  #                                                                             # 
 3  # Copyright (C) 2013 Edward d'Auvergne                                        # 
 4  #                                                                             # 
 5  # This file is part of the program relax (http://www.nmr-relax.com).          # 
 6  #                                                                             # 
 7  # This program 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 3 of the License, or           # 
10  # (at your option) any later version.                                         # 
11  #                                                                             # 
12  # This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.       # 
19  #                                                                             # 
20  ############################################################################### 
21   
22  # relax module imports. 
23  from data_store import Relax_data_store; ds = Relax_data_store() 
24  from test_suite.system_tests.base_classes import SystemTestCase 
25   
26   
27 -class Value(SystemTestCase):
28 """Class for testing various aspects specific to the value user functions.""" 29
30 - def setUp(self):
31 """Set up for all the functional tests.""" 32 33 # Create the data pipe. 34 self.interpreter.pipe.create('mf', 'mf')
35 36
37 - def test_value_copy(self):
38 """Test the value.copy user function.""" 39 40 # Create a data pipe. 41 self.interpreter.pipe.create('orig', 'mf') 42 43 # Add some new spins. 44 self.interpreter.spin.create(mol_name='test mol', res_name='Gly', res_num=1, spin_name='N') 45 self.interpreter.spin.create(mol_name='test mol', res_name='Gly', res_num=2, spin_name='N') 46 self.interpreter.spin.create(mol_name='test mol', res_name='Gly', res_num=3, spin_name='N') 47 48 # Add some values and errors. 49 self.interpreter.value.set(val=0.8, param='s2', spin_id=':1,2') 50 self.interpreter.value.set(val=0.1, param='s2', spin_id=':1', error=True) 51 self.interpreter.value.set(val=0.2, param='s2', spin_id=':2', error=True) 52 self.interpreter.value.set(val=0.3, param='s2', spin_id=':3', error=True) 53 54 # Create a new data pipe. 55 self.interpreter.pipe.create('new', 'mf') 56 57 # Copy the sequence data and value. 58 self.interpreter.sequence.copy(pipe_from='orig', pipe_to='new') 59 self.interpreter.value.copy(pipe_from='orig', pipe_to='new', param='s2') 60 61 # Loop over both the new and old pipes to check the data. 62 for pipe in ['orig', 'new']: 63 # Printout. 64 print("Checking the values of the '%s' data pipe." % pipe) 65 66 # Check the values. 67 self.assertEqual(ds[pipe].mol[0].res[0].spin[0].s2, 0.8) 68 self.assertEqual(ds[pipe].mol[0].res[1].spin[0].s2, 0.8) 69 self.assert_(not hasattr(ds[pipe].mol[0].res[2].spin[0], 's2')) 70 71 # Check the errors. 72 self.assertEqual(ds[pipe].mol[0].res[0].spin[0].s2_err, 0.1) 73 self.assertEqual(ds[pipe].mol[0].res[1].spin[0].s2_err, 0.2) 74 self.assertEqual(ds[pipe].mol[0].res[2].spin[0].s2_err, 0.3)
75