Package test_suite :: Package unit_tests :: Package _prompt :: Module test_n_state_model
[hide private]
[frames] | no frames]

Source Code for Module test_suite.unit_tests._prompt.test_n_state_model

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2008-2012 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 unittest import TestCase 
 25   
 26  # relax module imports. 
 27  from prompt.interpreter import Interpreter 
 28  from relax_errors import RelaxBoolError, RelaxIntError, RelaxLenError, RelaxListError, RelaxListNumError, RelaxNoneListNumError, RelaxNoneStrError, RelaxNumError, RelaxStrError 
 29  from test_suite.unit_tests.n_state_model_testing_base import N_state_model_base_class 
 30   
 31  # Unit test imports. 
 32  from data_types import DATA_TYPES 
 33   
 34   
35 -class Test_n_state_model(N_state_model_base_class, TestCase):
36 """Unit tests for the functions of the 'prompt.n_state_model' module.""" 37
38 - def __init__(self, methodName=None):
39 """Set up the test case class for the system tests.""" 40 41 # Execute the base __init__ methods. 42 super(Test_n_state_model, self).__init__(methodName) 43 44 # Load the interpreter. 45 self.interpreter = Interpreter(show_script=False, quit=False, raise_relax_error=True) 46 self.interpreter.populate_self() 47 self.interpreter.on(verbose=False) 48 49 # Alias the user function class. 50 self.n_state_model_fns = self.interpreter.n_state_model
51 52
54 """The pivot_point arg test of the n_state_model.CoM() user function.""" 55 56 # Loop over the data types. 57 for data in DATA_TYPES: 58 # Catch the int, float, and number list arguments, and skip them (if the length is 3). 59 if (data[0] == 'int list' or data[0] == 'float list' or data[0] == 'number list') and len(data[1]) == 3: 60 continue 61 62 # The argument test. 63 self.assertRaises(RelaxListNumError, self.n_state_model_fns.CoM, pivot_point=data[1])
64 65
66 - def test_CoM_argfail_centre(self):
67 """The centre arg test of the n_state_model.CoM() user function.""" 68 69 # Loop over the data types. 70 for data in DATA_TYPES: 71 # Catch the None, int, float, and number list arguments, and skip them (if the length is 3). 72 if data[0] == 'None' or ((data[0] == 'int list' or data[0] == 'float list' or data[0] == 'number list') and len(data[1]) == 3): 73 continue 74 75 # The argument test. 76 self.assertRaises(RelaxNoneListNumError, self.n_state_model_fns.CoM, centre=data[1])
77 78
80 """The cone_type arg test of the n_state_model.cone_pdb() user function.""" 81 82 # Loop over the data types. 83 for data in DATA_TYPES: 84 # Catch the str arguments, and skip them. 85 if data[0] == 'str': 86 continue 87 88 # The argument test. 89 self.assertRaises(RelaxStrError, self.n_state_model_fns.cone_pdb, cone_type=data[1])
90 91
93 """The scale arg test of the n_state_model.cone_pdb() user function.""" 94 95 # Loop over the data types. 96 for data in DATA_TYPES: 97 # Catch the float, bin, and int arguments, and skip them. 98 if data[0] == 'float' or data[0] == 'bin' or data[0] == 'int': 99 continue 100 101 # The argument test. 102 self.assertRaises(RelaxNumError, self.n_state_model_fns.cone_pdb, cone_type='', scale=data[1])
103 104
106 """The file arg test of the n_state_model.cone_pdb() user function.""" 107 108 # Loop over the data types. 109 for data in DATA_TYPES: 110 # Catch the str arguments, and skip them. 111 if data[0] == 'str': 112 continue 113 114 # The argument test. 115 self.assertRaises(RelaxStrError, self.n_state_model_fns.cone_pdb, cone_type='', file=data[1])
116 117
119 """The dir arg test of the n_state_model.cone_pdb() user function.""" 120 121 # Loop over the data types. 122 for data in DATA_TYPES: 123 # Catch the None and str arguments, and skip them. 124 if data[0] == 'None' or data[0] == 'str': 125 continue 126 127 # The argument test. 128 self.assertRaises(RelaxNoneStrError, self.n_state_model_fns.cone_pdb, cone_type='', dir=data[1])
129 130
132 """The force arg test of the n_state_model.cone_pdb() user function.""" 133 134 # Loop over the data types. 135 for data in DATA_TYPES: 136 # Catch the bool arguments, and skip them. 137 if data[0] == 'bool': 138 continue 139 140 # The argument test. 141 self.assertRaises(RelaxBoolError, self.n_state_model_fns.cone_pdb, cone_type='', force=data[1])
142 143
145 """Failure of the N arg of the n_state_model.number_of_states() user function.""" 146 147 # Loop over the data types. 148 for data in DATA_TYPES: 149 # Catch the bin and int arguments, and skip them. 150 if data[0] == 'bin' or data[0] == 'int': 151 continue 152 153 # The argument test. 154 self.assertRaises(RelaxIntError, self.n_state_model_fns.number_of_states, N=data[1])
155 156
158 """Failure of the ref arg of the n_state_model.ref_domain() user function.""" 159 160 # Loop over the data types. 161 for data in DATA_TYPES: 162 # Catch the str arguments, and skip them. 163 if data[0] == 'str': 164 continue 165 166 # The argument test. 167 self.assertRaises(RelaxStrError, self.n_state_model_fns.ref_domain, ref=data[1])
168 169
171 """Failure of the model arg of the n_state_model.select_model() user function.""" 172 173 # Loop over the data types. 174 for data in DATA_TYPES: 175 # Catch the str arguments, and skip them. 176 if data[0] == 'str': 177 continue 178 179 # The argument test. 180 self.assertRaises(RelaxStrError, self.n_state_model_fns.select_model, model=data[1])
181