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

Source Code for Module test_suite.unit_tests._prompt.test_structure

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2007-2008, 2010 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.structure import Structure 
 28  from relax_errors import RelaxBoolError, RelaxFloatError, RelaxIntError, RelaxNoneIntError, RelaxNoneIntListIntError, RelaxNoneStrError, RelaxNoneStrListStrError, RelaxNumError, RelaxStrError 
 29  from test_suite.unit_tests.structure_testing_base import Structure_base_class 
 30   
 31  # Unit test imports. 
 32  from data_types import DATA_TYPES 
 33   
 34   
35 -class Test_structure(Structure_base_class, TestCase):
36 """Unit tests for the functions of the 'prompt.structure' module.""" 37 38 # Instantiate the user function class. 39 structure_fns = Structure() 40 41
43 """The scale arg test of the structure.create_diff_tensor_pdb() user function.""" 44 45 # Loop over the data types. 46 for data in DATA_TYPES: 47 # Catch the float, bin, and int arguments, and skip them. 48 if data[0] == 'float' or data[0] == 'bin' or data[0] == 'int': 49 continue 50 51 # The argument test. 52 self.assertRaises(RelaxNumError, self.structure_fns.create_diff_tensor_pdb, scale=data[1])
53 54
56 """The file arg test of the structure.create_diff_tensor_pdb() user function.""" 57 58 # Loop over the data types. 59 for data in DATA_TYPES: 60 # Catch the str arguments, and skip them. 61 if data[0] == 'str': 62 continue 63 64 # The argument test. 65 self.assertRaises(RelaxStrError, self.structure_fns.create_diff_tensor_pdb, file=data[1])
66 67
69 """The dir arg test of the structure.create_diff_tensor_pdb() user function.""" 70 71 # Loop over the data types. 72 for data in DATA_TYPES: 73 # Catch the None and str arguments, and skip them. 74 if data[0] == 'None' or data[0] == 'str': 75 continue 76 77 # The argument test. 78 self.assertRaises(RelaxNoneStrError, self.structure_fns.create_diff_tensor_pdb, dir=data[1])
79 80
82 """The force arg test of the structure.create_diff_tensor_pdb() user function.""" 83 84 # Loop over the data types. 85 for data in DATA_TYPES: 86 # Catch the bool arguments, and skip them. 87 if data[0] == 'bool': 88 continue 89 90 # The argument test. 91 self.assertRaises(RelaxBoolError, self.structure_fns.create_diff_tensor_pdb, force=data[1])
92 93
95 """The length arg test of the structure.create_vector_dist() user function.""" 96 97 # Loop over the data types. 98 for data in DATA_TYPES: 99 # Catch the number arguments, and skip them. 100 if data[0] == 'bin' or data[0] == 'int' or data[0] == 'float': 101 continue 102 103 # The argument test. 104 self.assertRaises(RelaxNumError, self.structure_fns.create_vector_dist, length=data[1])
105 106
108 """The file arg test of the structure.create_vector_dist() user function.""" 109 110 # Loop over the data types. 111 for data in DATA_TYPES: 112 # Catch the str arguments, and skip them. 113 if data[0] == 'str': 114 continue 115 116 # The argument test. 117 self.assertRaises(RelaxStrError, self.structure_fns.create_vector_dist, file=data[1])
118 119
121 """The dir arg test of the structure.create_vector_dist() user function.""" 122 123 # Loop over the data types. 124 for data in DATA_TYPES: 125 # Catch the None and str arguments, and skip them. 126 if data[0] == 'None' or data[0] == 'str': 127 continue 128 129 # The argument test. 130 self.assertRaises(RelaxNoneStrError, self.structure_fns.create_vector_dist, dir=data[1])
131 132
134 """The symmetry arg test of the structure.create_vector_dist() user function.""" 135 136 # Loop over the data types. 137 for data in DATA_TYPES: 138 # Catch the bool arguments, and skip them. 139 if data[0] == 'bool': 140 continue 141 142 # The argument test. 143 self.assertRaises(RelaxBoolError, self.structure_fns.create_vector_dist, symmetry=data[1])
144 145
147 """The force arg test of the structure.create_vector_dist() user function.""" 148 149 # Loop over the data types. 150 for data in DATA_TYPES: 151 # Catch the bool arguments, and skip them. 152 if data[0] == 'bool': 153 continue 154 155 # The argument test. 156 self.assertRaises(RelaxBoolError, self.structure_fns.create_vector_dist, force=data[1])
157 158
160 """The spin_id arg test of the structure.load_spins() user function.""" 161 162 # Loop over the data types. 163 for data in DATA_TYPES: 164 # Catch the None and str arguments, and skip them. 165 if data[0] == 'None' or data[0] == 'str': 166 continue 167 168 # The argument test. 169 self.assertRaises(RelaxNoneStrError, self.structure_fns.load_spins, spin_id=data[1])
170 171
173 """The file arg test of the structure.read_pdb() user function.""" 174 175 # Loop over the data types. 176 for data in DATA_TYPES: 177 # Catch the str arguments, and skip them. 178 if data[0] == 'str': 179 continue 180 181 # The argument test. 182 self.assertRaises(RelaxStrError, self.structure_fns.read_pdb, file=data[1])
183 184
186 """The dir arg test of the structure.read_pdb() user function.""" 187 188 # Loop over the data types. 189 for data in DATA_TYPES: 190 # Catch the None and str arguments, and skip them. 191 if data[0] == 'None' or data[0] == 'str': 192 continue 193 194 # The argument test. 195 self.assertRaises(RelaxNoneStrError, self.structure_fns.read_pdb, file='test.pdb', dir=data[1])
196 197
199 """The read_mol arg test of the structure.read_pdb() user function.""" 200 201 # Loop over the data types. 202 for data in DATA_TYPES: 203 # Catch the None, bin, int, and int list arguments, and skip them. 204 if data[0] == 'None' or data[0] == 'bin' or data[0] == 'int' or data[0] == 'int list': 205 continue 206 207 # The argument test. 208 self.assertRaises(RelaxNoneIntListIntError, self.structure_fns.read_pdb, file='test.pdb', read_mol=data[1])
209 210
212 """The set_mol_name arg test of the structure.read_pdb() user function.""" 213 214 # Loop over the data types. 215 for data in DATA_TYPES: 216 # Catch the None, str, and str list arguments, and skip them. 217 if data[0] == 'None' or data[0] == 'str' or data[0] == 'str list': 218 continue 219 220 # The argument test. 221 self.assertRaises(RelaxNoneStrListStrError, self.structure_fns.read_pdb, file='test.pdb', set_mol_name=data[1])
222 223
225 """The read_model arg test of the structure.read_pdb() user function.""" 226 227 # Loop over the data types. 228 for data in DATA_TYPES: 229 # Catch the None, bin, int, and int list arguments, and skip them. 230 if data[0] == 'None' or data[0] == 'bin' or data[0] == 'int' or data[0] == 'int list': 231 continue 232 233 # The argument test. 234 self.assertRaises(RelaxNoneIntListIntError, self.structure_fns.read_pdb, file='test.pdb', read_model=data[1])
235 236
238 """The set_model_num arg test of the structure.read_pdb() user function.""" 239 240 # Loop over the data types. 241 for data in DATA_TYPES: 242 # Catch the None, bin, int, and int list arguments, and skip them. 243 if data[0] == 'None' or data[0] == 'bin' or data[0] == 'int' or data[0] == 'int list': 244 continue 245 246 # The argument test. 247 self.assertRaises(RelaxNoneIntListIntError, self.structure_fns.read_pdb, file='test.pdb', set_model_num=data[1])
248 249
251 """The parser arg test of the structure.read_pdb() user function.""" 252 253 # Loop over the data types. 254 for data in DATA_TYPES: 255 # Catch the str arguments, and skip them. 256 if data[0] == 'str': 257 continue 258 259 # The argument test. 260 self.assertRaises(RelaxStrError, self.structure_fns.read_pdb, parser=data[1])
261 262
264 """The attached arg test of the structure.vectors() user function.""" 265 266 # Loop over the data types. 267 for data in DATA_TYPES: 268 # Catch the str arguments, and skip them. 269 if data[0] == 'str': 270 continue 271 272 # The argument test. 273 self.assertRaises(RelaxStrError, self.structure_fns.vectors, attached=data[1])
274 275
277 """The spin_id arg test of the structure.vectors() user function.""" 278 279 # Loop over the data types. 280 for data in DATA_TYPES: 281 # Catch the None and str arguments, and skip them. 282 if data[0] == 'None' or data[0] == 'str': 283 continue 284 285 # The argument test. 286 self.assertRaises(RelaxNoneStrError, self.structure_fns.vectors, spin_id=data[1])
287 288
290 """The model arg test of the structure.vectors() user function.""" 291 292 # Loop over the data types. 293 for data in DATA_TYPES: 294 # Catch the None, bin, and int arguments, and skip them. 295 if data[0] == 'None' or data[0] == 'bin' or data[0] == 'int': 296 continue 297 298 # The argument test. 299 self.assertRaises(RelaxNoneIntError, self.structure_fns.vectors, model=data[1])
300 301
303 """The verbosity arg test of the structure.vectors() user function.""" 304 305 # Loop over the data types. 306 for data in DATA_TYPES: 307 # Catch the bin and int arguments, and skip them. 308 if data[0] == 'bin' or data[0] == 'int': 309 continue 310 311 # The argument test. 312 self.assertRaises(RelaxIntError, self.structure_fns.vectors, verbosity=data[1])
313 314
315 - def test_vectors_argfail_ave(self):
316 """The ave arg test of the structure.vectors() user function.""" 317 318 # Loop over the data types. 319 for data in DATA_TYPES: 320 # Catch the bool arguments, and skip them. 321 if data[0] == 'bool': 322 continue 323 324 # The argument test. 325 self.assertRaises(RelaxBoolError, self.structure_fns.vectors, ave=data[1])
326 327
329 """The unit arg test of the structure.vectors() user function.""" 330 331 # Loop over the data types. 332 for data in DATA_TYPES: 333 # Catch the bool arguments, and skip them. 334 if data[0] == 'bool': 335 continue 336 337 # The argument test. 338 self.assertRaises(RelaxBoolError, self.structure_fns.vectors, unit=data[1])
339