Trees | Indices | Help |
|
---|
|
1 ############################################################################### 2 # # 3 # Copyright (C) 2007-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 # relax module imports. 24 from generic_fns import align_tensor 25 from prompt.align_tensor import Align_tensor 26 from relax_errors import RelaxError, RelaxBoolError, RelaxFloatError, RelaxIntError, RelaxNoneListStrError, RelaxNoneStrError, RelaxTupleNumError, RelaxStrError 27 from test_suite.unit_tests.align_tensor_testing_base import Align_tensor_base_class 28 29 # Unit test imports. 30 from data_types import DATA_TYPES 31 3234 """Unit tests for the functions of the 'prompt.align_tensor' module.""" 35 36 # Instantiate the user function class. 37 align_tensor_fns = Align_tensor() 3831740 """Failure of the tensor_from arg of the align_tensor.copy() user function.""" 41 42 # Loop over the data types. 43 for data in DATA_TYPES: 44 # Catch the str argument, and skip it. 45 if data[0] == 'str': 46 continue 47 48 # The argument test. 49 self.assertRaises(RelaxStrError, self.align_tensor_fns.copy, tensor_from=data[1])50 5153 """The pipe_from arg test of the align_tensor.copy() user function.""" 54 55 # Loop over the data types. 56 for data in DATA_TYPES: 57 # Catch the None and str arguments, and skip them. 58 if data[0] == 'None' or data[0] == 'str': 59 continue 60 61 # The argument test. 62 self.assertRaises(RelaxNoneStrError, self.align_tensor_fns.copy, tensor_from='Pf1', pipe_from=data[1])63 6466 """Failure of the tensor_to arg of the align_tensor.copy() user function.""" 67 68 # Loop over the data types. 69 for data in DATA_TYPES: 70 # Catch the str argument, and skip it. 71 if data[0] == 'str': 72 continue 73 74 # The argument test. 75 self.assertRaises(RelaxStrError, self.align_tensor_fns.copy, tensor_to=data[1])76 7779 """The pipe_to arg test of the align_tensor.copy() user function.""" 80 81 # Loop over the data types. 82 for data in DATA_TYPES: 83 # Catch the None and str arguments, and skip them. 84 if data[0] == 'None' or data[0] == 'str': 85 continue 86 87 # The argument test. 88 self.assertRaises(RelaxNoneStrError, self.align_tensor_fns.copy, tensor_from='Pf1', tensor_to='Pf1', pipe_to=data[1])89 9092 """The pipe_from and pipe_to arg test of the align_tensor.copy() user function.""" 93 94 # Test that both cannot be None (the default)! 95 self.assertRaises(RelaxError, self.align_tensor_fns.copy, tensor_from='Pf1', tensor_to='Pf1')96 9799 """Failure of the tensor arg of the align_tensor.delete() user function.""" 100 101 # Loop over the data types. 102 for data in DATA_TYPES: 103 # Catch the str argument, and skip it. 104 if data[0] == 'None' or data[0] == 'str': 105 continue 106 107 # The argument test. 108 self.assertRaises(RelaxNoneStrError, self.align_tensor_fns.delete, tensor=data[1])109 110112 """Failure of the tensor arg of the align_tensor.display() user function.""" 113 114 # Loop over the data types. 115 for data in DATA_TYPES: 116 # Catch the None and str arguments, and skip them. 117 if data[0] == 'None' or data[0] == 'str': 118 continue 119 120 # The argument test. 121 self.assertRaises(RelaxNoneStrError, self.align_tensor_fns.display, tensor=data[1])122 123125 """Failure of the tensor arg of the align_tensor.init() user function.""" 126 127 # Loop over the data types. 128 for data in DATA_TYPES: 129 # Catch the str argument, and skip it. 130 if data[0] == 'str': 131 continue 132 133 # The argument test. 134 self.assertRaises(RelaxStrError, self.align_tensor_fns.init, tensor=data[1])135 136138 """Failure of the params arg of the align_tensor.init() user function.""" 139 140 # Loop over the data types. 141 for data in DATA_TYPES: 142 # Catch the tuple arguments. 143 if data[0] == 'tuple' or data[0] == 'float tuple' or data[0] == 'str tuple': 144 # Correct tuple length. 145 if len(data[1]) == 5: 146 continue 147 148 # The argument test. 149 self.assertRaises(RelaxTupleNumError, self.align_tensor_fns.init, tensor='Pf1', params=data[1])150 151153 """The scale arg test of the align_tensor.init() user function.""" 154 155 # Loop over the data types. 156 for data in DATA_TYPES: 157 # Catch the float argument, and skip it. 158 if data[0] == 'float': 159 continue 160 161 # The argument test. 162 self.assertRaises(RelaxFloatError, self.align_tensor_fns.init, tensor='Pf1', params=(0.0, 0.0, 0.0, 0.0, 0.0), scale=data[1])163 164166 """The angle_units arg test of the align_tensor.init() user function.""" 167 168 # Loop over the data types. 169 for data in DATA_TYPES: 170 # Catch the str argument, and skip it. 171 if data[0] == 'str': 172 continue 173 174 # The argument test. 175 self.assertRaises(RelaxStrError, self.align_tensor_fns.init, params=(0.0, 0.0, 0.0, 0.0, 0.0), angle_units=data[1])176 177179 """The proper failure of the align_tensor.init() user function for the param_types argument.""" 180 181 # Loop over the data types. 182 for data in DATA_TYPES: 183 # Catch the int and bin arguments, and skip them. 184 if data[0] == 'int' or data[0] == 'bin': 185 continue 186 187 # The argument test. 188 self.assertRaises(RelaxIntError, self.align_tensor_fns.init, tensor='Pf1', params=(0.0, 0.0, 0.0, 0.0, 0.0), param_types=data[1])189 190192 """The errors arg test of the align_tensor.init() user function.""" 193 194 # Loop over the data types. 195 for data in DATA_TYPES: 196 # Catch the bool arguments, and skip them. 197 if data[0] == 'bool': 198 continue 199 200 # The argument test. 201 self.assertRaises(RelaxBoolError, self.align_tensor_fns.init, tensor='Pf1', params=(0.0, 0.0, 0.0, 0.0, 0.0), errors=data[1])202 203205 """The proper failure of the align_tensor.matrix_angles() user function for the basis_set argument.""" 206 207 # Add an alignment tensor. 208 align_tensor.init('a', (0.0, 0.0, 0.0, 0.0, 0.0)) 209 210 # Loop over the data types. 211 for data in DATA_TYPES: 212 # Catch the int and bin arguments, and skip them. 213 if data[0] == 'int' or data[0] == 'bin': 214 continue 215 216 # The argument test. 217 self.assertRaises(RelaxIntError, self.align_tensor_fns.matrix_angles, basis_set=data[1])218 219221 """The tensors arg unit test of the align_tensor.matrix_angles() user function.""" 222 223 # Add an alignment tensor. 224 align_tensor.init('a', (0.0, 0.0, 0.0, 0.0, 0.0)) 225 226 # Loop over the data types. 227 for data in DATA_TYPES: 228 # Catch the None and str list arguments, and skip them. 229 if data[0] == 'None' or data[0] == 'str list': 230 continue 231 232 # The argument test. 233 self.assertRaises(RelaxNoneListStrError, self.align_tensor_fns.matrix_angles, tensors=data[1])234 235237 """Failure of the full_tensor arg of the align_tensor.reduction() user function.""" 238 239 # Loop over the data types. 240 for data in DATA_TYPES: 241 # Catch the str argument, and skip it. 242 if data[0] == 'str': 243 continue 244 245 # The argument test. 246 self.assertRaises(RelaxStrError, self.align_tensor_fns.reduction, full_tensor=data[1])247 248250 """Failure of the red_tensor arg of the align_tensor.reduction() user function.""" 251 252 # Loop over the data types. 253 for data in DATA_TYPES: 254 # Catch the str argument, and skip it. 255 if data[0] == 'str': 256 continue 257 258 # The argument test. 259 self.assertRaises(RelaxStrError, self.align_tensor_fns.reduction, full_tensor='test', red_tensor=data[1])260262 """Failure of the tensor arg of the align_tensor.set_domain() user function.""" 263 264 # Loop over the data types. 265 for data in DATA_TYPES: 266 # Catch the str argument, and skip it. 267 if data[0] == 'str': 268 continue 269 270 # The argument test. 271 self.assertRaises(RelaxStrError, self.align_tensor_fns.set_domain, tensor=data[1])272 273275 """Failure of the domain arg of the align_tensor.set_domain() user function.""" 276 277 # Loop over the data types. 278 for data in DATA_TYPES: 279 # Catch the str argument, and skip it. 280 if data[0] == 'str': 281 continue 282 283 # The argument test. 284 self.assertRaises(RelaxStrError, self.align_tensor_fns.set_domain, domain=data[1])285 286288 """The proper failure of the align_tensor.svd() user function for the basis_set argument.""" 289 290 # Add an alignment tensor. 291 align_tensor.init('a', (0.0, 0.0, 0.0, 0.0, 0.0)) 292 293 # Loop over the data types. 294 for data in DATA_TYPES: 295 # Catch the int and bin arguments, and skip them. 296 if data[0] == 'int' or data[0] == 'bin': 297 continue 298 299 # The argument test. 300 self.assertRaises(RelaxIntError, self.align_tensor_fns.svd, basis_set=data[1])301 302304 """The tensors arg unit test of the align_tensor.svd() user function.""" 305 306 # Add an alignment tensor. 307 align_tensor.init('a', (0.0, 0.0, 0.0, 0.0, 0.0)) 308 309 # Loop over the data types. 310 for data in DATA_TYPES: 311 # Catch the None and str list arguments, and skip them. 312 if data[0] == 'None' or data[0] == 'str list': 313 continue 314 315 # The argument test. 316 self.assertRaises(RelaxNoneListStrError, self.align_tensor_fns.svd, tensors=data[1])
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Apr 10 13:33:07 2013 | http://epydoc.sourceforge.net |