Trees | Indices | Help |
|
---|
|
1 ############################################################################### 2 # # 3 # Copyright (C) 2008-2012 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 relax_errors import RelaxBoolError, RelaxIntError, RelaxLenError, RelaxListError, RelaxListNumError, RelaxNoneListNumError, RelaxNoneStrError, RelaxNumError, RelaxStrError 28 from test_suite.unit_tests.n_state_model_testing_base import N_state_model_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.n_state_model' module.""" 3618038 """Set up the test case class for the system tests.""" 39 40 # Execute the base __init__ methods. 41 super(Test_n_state_model, self).__init__(methodName) 42 43 # Load the interpreter. 44 self.interpreter = Interpreter(show_script=False, quit=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.n_state_model_fns = self.interpreter.n_state_model50 5153 """The pivot_point arg test of the n_state_model.CoM() user function.""" 54 55 # Loop over the data types. 56 for data in DATA_TYPES: 57 # Catch the int, float, and number list arguments, and skip them (if the length is 3). 58 if (data[0] == 'int list' or data[0] == 'float list' or data[0] == 'number list') and len(data[1]) == 3: 59 continue 60 61 # The argument test. 62 self.assertRaises(RelaxListNumError, self.n_state_model_fns.CoM, pivot_point=data[1])63 6466 """The centre arg test of the n_state_model.CoM() user function.""" 67 68 # Loop over the data types. 69 for data in DATA_TYPES: 70 # Catch the None, int, float, and number list arguments, and skip them (if the length is 3). 71 if data[0] == 'None' or ((data[0] == 'int list' or data[0] == 'float list' or data[0] == 'number list') and len(data[1]) == 3): 72 continue 73 74 # The argument test. 75 self.assertRaises(RelaxNoneListNumError, self.n_state_model_fns.CoM, centre=data[1])76 7779 """The cone_type arg test of the n_state_model.cone_pdb() user function.""" 80 81 # Loop over the data types. 82 for data in DATA_TYPES: 83 # Catch the str arguments, and skip them. 84 if data[0] == 'str': 85 continue 86 87 # The argument test. 88 self.assertRaises(RelaxStrError, self.n_state_model_fns.cone_pdb, cone_type=data[1])89 9092 """The scale arg test of the n_state_model.cone_pdb() user function.""" 93 94 # Loop over the data types. 95 for data in DATA_TYPES: 96 # Catch the float, bin, and int arguments, and skip them. 97 if data[0] == 'float' or data[0] == 'bin' or data[0] == 'int': 98 continue 99 100 # The argument test. 101 self.assertRaises(RelaxNumError, self.n_state_model_fns.cone_pdb, cone_type='', scale=data[1])102 103105 """The file arg test of the n_state_model.cone_pdb() user function.""" 106 107 # Loop over the data types. 108 for data in DATA_TYPES: 109 # Catch the str arguments, and skip them. 110 if data[0] == 'str': 111 continue 112 113 # The argument test. 114 self.assertRaises(RelaxStrError, self.n_state_model_fns.cone_pdb, cone_type='', file=data[1])115 116118 """The dir arg test of the n_state_model.cone_pdb() user function.""" 119 120 # Loop over the data types. 121 for data in DATA_TYPES: 122 # Catch the None and str arguments, and skip them. 123 if data[0] == 'None' or data[0] == 'str': 124 continue 125 126 # The argument test. 127 self.assertRaises(RelaxNoneStrError, self.n_state_model_fns.cone_pdb, cone_type='', dir=data[1])128 129131 """The force arg test of the n_state_model.cone_pdb() user function.""" 132 133 # Loop over the data types. 134 for data in DATA_TYPES: 135 # Catch the bool arguments, and skip them. 136 if data[0] == 'bool': 137 continue 138 139 # The argument test. 140 self.assertRaises(RelaxBoolError, self.n_state_model_fns.cone_pdb, cone_type='', force=data[1])141 142144 """Failure of the N arg of the n_state_model.number_of_states() user function.""" 145 146 # Loop over the data types. 147 for data in DATA_TYPES: 148 # Catch the bin and int arguments, and skip them. 149 if data[0] == 'bin' or data[0] == 'int': 150 continue 151 152 # The argument test. 153 self.assertRaises(RelaxIntError, self.n_state_model_fns.number_of_states, N=data[1])154 155157 """Failure of the ref arg of the n_state_model.ref_domain() user function.""" 158 159 # Loop over the data types. 160 for data in DATA_TYPES: 161 # Catch the str arguments, and skip them. 162 if data[0] == 'str': 163 continue 164 165 # The argument test. 166 self.assertRaises(RelaxStrError, self.n_state_model_fns.ref_domain, ref=data[1])167 168170 """Failure of the model arg of the n_state_model.select_model() user function.""" 171 172 # Loop over the data types. 173 for data in DATA_TYPES: 174 # Catch the str arguments, and skip them. 175 if data[0] == 'str': 176 continue 177 178 # The argument test. 179 self.assertRaises(RelaxStrError, self.n_state_model_fns.select_model, model=data[1])
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Apr 10 15:06:34 2013 | http://epydoc.sourceforge.net |