Trees | Indices | Help |
|
---|
|
1 ############################################################################### 2 # # 3 # Copyright (C) 2007-2008,2012,2019 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 # Python module imports. 23 from unittest import TestCase 24 25 # relax module imports. 26 from prompt.interpreter import Interpreter 27 from lib.errors import RelaxBoolError, RelaxIntListIntError, RelaxNumError, RelaxStrError, RelaxStrFileError, RelaxStrListStrError 28 from test_suite.unit_tests.structure_testing_base import Structure_base_class 29 30 # Unit test imports. 31 from test_suite.unit_tests._prompt.data_types import DATA_TYPES 32 3335 """Unit tests for the functions of the 'prompt.structure' module.""" 3625838 """Set up the test case class for the system tests.""" 39 40 # Execute the base __init__ methods. 41 super(Test_structure, self).__init__(methodName) 42 43 # Load the interpreter. 44 self.interpreter = Interpreter(show_script=False, raise_relax_error=True) 45 self.interpreter.populate_self() 46 self.interpreter.on(verbose=False) 47 48 # Alias the user function class. 49 self.structure_fns = self.interpreter.structure50 5153 """The scale arg test of the structure.create_diff_tensor_pdb() user function.""" 54 55 # Loop over the data types. 56 for data in DATA_TYPES: 57 # Catch the float, bin, and int arguments, and skip them. 58 if data[0] == 'float' or data[0] == 'bin' or data[0] == 'int': 59 continue 60 61 # The argument test. 62 self.assertRaises(RelaxNumError, self.structure_fns.create_diff_tensor_pdb, scale=data[1])63 6466 """The file arg test of the structure.create_diff_tensor_pdb() user function.""" 67 68 # Loop over the data types. 69 for data in DATA_TYPES: 70 # Catch the file and str arguments, and skip them. 71 if data[0] in ['file', 'str']: 72 continue 73 74 # The argument test. 75 self.assertRaises(RelaxStrFileError, self.structure_fns.create_diff_tensor_pdb, file=data[1])76 7779 """The dir arg test of the structure.create_diff_tensor_pdb() 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(RelaxStrError, self.structure_fns.create_diff_tensor_pdb, dir=data[1])89 9092 """The force arg test of the structure.create_diff_tensor_pdb() user function.""" 93 94 # Loop over the data types. 95 for data in DATA_TYPES: 96 # Catch the bool arguments, and skip them. 97 if data[0] == 'bool': 98 continue 99 100 # The argument test. 101 self.assertRaises(RelaxBoolError, self.structure_fns.create_diff_tensor_pdb, force=data[1])102 103105 """The length arg test of the structure.create_vector_dist() user function.""" 106 107 # Loop over the data types. 108 for data in DATA_TYPES: 109 # Catch the number arguments, and skip them. 110 if data[0] == 'bin' or data[0] == 'int' or data[0] == 'float': 111 continue 112 113 # The argument test. 114 self.assertRaises(RelaxNumError, self.structure_fns.create_vector_dist, length=data[1])115 116118 """The file arg test of the structure.create_vector_dist() user function.""" 119 120 # Loop over the data types. 121 for data in DATA_TYPES: 122 # Catch the file and str arguments, and skip them. 123 if data[0] in ['file', 'str']: 124 continue 125 126 # The argument test. 127 self.assertRaises(RelaxStrFileError, self.structure_fns.create_vector_dist, file=data[1])128 129131 """The dir arg test of the structure.create_vector_dist() user function.""" 132 133 # Loop over the data types. 134 for data in DATA_TYPES: 135 # Catch the None and str arguments, and skip them. 136 if data[0] == 'None' or data[0] == 'str': 137 continue 138 139 # The argument test. 140 self.assertRaises(RelaxStrError, self.structure_fns.create_vector_dist, dir=data[1])141 142144 """The symmetry arg test of the structure.create_vector_dist() user function.""" 145 146 # Loop over the data types. 147 for data in DATA_TYPES: 148 # Catch the bool arguments, and skip them. 149 if data[0] == 'bool': 150 continue 151 152 # The argument test. 153 self.assertRaises(RelaxBoolError, self.structure_fns.create_vector_dist, symmetry=data[1])154 155157 """The force arg test of the structure.create_vector_dist() user function.""" 158 159 # Loop over the data types. 160 for data in DATA_TYPES: 161 # Catch the bool arguments, and skip them. 162 if data[0] == 'bool': 163 continue 164 165 # The argument test. 166 self.assertRaises(RelaxBoolError, self.structure_fns.create_vector_dist, force=data[1])167 168170 """The spin_id arg test of the structure.load_spins() user function.""" 171 172 # Loop over the data types. 173 for data in DATA_TYPES: 174 # Catch the None and str arguments, and skip them. 175 if data[0] == 'None' or data[0] == 'str': 176 continue 177 178 # The argument test. 179 self.assertRaises(RelaxStrError, self.structure_fns.load_spins, spin_id=data[1])180 181183 """The file arg test of the structure.read_pdb() user function.""" 184 185 # Loop over the data types. 186 for data in DATA_TYPES: 187 # Catch the file and str arguments, and skip them. 188 if data[0] in ['file', 'str']: 189 continue 190 191 # The argument test. 192 self.assertRaises(RelaxStrFileError, self.structure_fns.read_pdb, file=data[1])193 194196 """The dir arg test of the structure.read_pdb() user function.""" 197 198 # Loop over the data types. 199 for data in DATA_TYPES: 200 # Catch the None and str arguments, and skip them. 201 if data[0] == 'None' or data[0] == 'str': 202 continue 203 204 # The argument test. 205 self.assertRaises(RelaxStrError, self.structure_fns.read_pdb, file='test.pdb', dir=data[1])206 207209 """The read_mol arg test of the structure.read_pdb() user function.""" 210 211 # Loop over the data types. 212 for data in DATA_TYPES: 213 # Catch the None, bin, int, and int list arguments, and skip them. 214 if data[0] == 'None' or data[0] == 'bin' or data[0] == 'int' or data[0] == 'int list': 215 continue 216 217 # The argument test. 218 self.assertRaises(RelaxIntListIntError, self.structure_fns.read_pdb, file='test.pdb', read_mol=data[1])219 220222 """The set_mol_name arg test of the structure.read_pdb() user function.""" 223 224 # Loop over the data types. 225 for data in DATA_TYPES: 226 # Catch the None, str, and str list arguments, and skip them. 227 if data[0] == 'None' or data[0] == 'str' or data[0] == 'str list': 228 continue 229 230 # The argument test. 231 self.assertRaises(RelaxStrListStrError, self.structure_fns.read_pdb, file='test.pdb', set_mol_name=data[1])232 233235 """The read_model arg test of the structure.read_pdb() user function.""" 236 237 # Loop over the data types. 238 for data in DATA_TYPES: 239 # Catch the None, bin, int, and int list arguments, and skip them. 240 if data[0] == 'None' or data[0] == 'bin' or data[0] == 'int' or data[0] == 'int list': 241 continue 242 243 # The argument test. 244 self.assertRaises(RelaxIntListIntError, self.structure_fns.read_pdb, file='test.pdb', read_model=data[1])245 246248 """The set_model_num arg test of the structure.read_pdb() user function.""" 249 250 # Loop over the data types. 251 for data in DATA_TYPES: 252 # Catch the None, bin, int, and int list arguments, and skip them. 253 if data[0] == 'None' or data[0] == 'bin' or data[0] == 'int' or data[0] == 'int list': 254 continue 255 256 # The argument test. 257 self.assertRaises(RelaxIntListIntError, self.structure_fns.read_pdb, file='test.pdb', set_model_num=data[1])
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sat Jun 8 10:45:07 2024 | http://epydoc.sourceforge.net |