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-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.n_state_model import N_state_model 
 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 # Instantiate the user function class. 39 n_state_model_fns = N_state_model() 40 41
43 """The pivot_point arg test of the n_state_model.CoM() user function.""" 44 45 # Loop over the data types. 46 for data in DATA_TYPES: 47 # Catch the int, float, and number list arguments, and skip them (if the length is 3). 48 if (data[0] == 'int list' or data[0] == 'float list' or data[0] == 'number list') and len(data[1]) == 3: 49 continue 50 51 # The argument test. 52 self.assertRaises(RelaxListNumError, self.n_state_model_fns.CoM, pivot_point=data[1])
53 54
55 - def test_CoM_argfail_centre(self):
56 """The centre arg test of the n_state_model.CoM() user function.""" 57 58 # Loop over the data types. 59 for data in DATA_TYPES: 60 # Catch the None, int, float, and number list arguments, and skip them (if the length is 3). 61 if data[0] == 'None' or ((data[0] == 'int list' or data[0] == 'float list' or data[0] == 'number list') and len(data[1]) == 3): 62 continue 63 64 # The argument test. 65 self.assertRaises(RelaxNoneListNumError, self.n_state_model_fns.CoM, centre=data[1])
66 67
69 """The cone_type arg test of the n_state_model.cone_pdb() user function.""" 70 71 # Loop over the data types. 72 for data in DATA_TYPES: 73 # Catch the str arguments, and skip them. 74 if data[0] == 'str': 75 continue 76 77 # The argument test. 78 self.assertRaises(RelaxStrError, self.n_state_model_fns.cone_pdb, cone_type=data[1])
79 80
82 """The scale arg test of the n_state_model.cone_pdb() user function.""" 83 84 # Loop over the data types. 85 for data in DATA_TYPES: 86 # Catch the float, bin, and int arguments, and skip them. 87 if data[0] == 'float' or data[0] == 'bin' or data[0] == 'int': 88 continue 89 90 # The argument test. 91 self.assertRaises(RelaxNumError, self.n_state_model_fns.cone_pdb, cone_type='', scale=data[1])
92 93
95 """The file arg test of the n_state_model.cone_pdb() user function.""" 96 97 # Loop over the data types. 98 for data in DATA_TYPES: 99 # Catch the str arguments, and skip them. 100 if data[0] == 'str': 101 continue 102 103 # The argument test. 104 self.assertRaises(RelaxStrError, self.n_state_model_fns.cone_pdb, cone_type='', file=data[1])
105 106
108 """The dir arg test of the n_state_model.cone_pdb() user function.""" 109 110 # Loop over the data types. 111 for data in DATA_TYPES: 112 # Catch the None and str arguments, and skip them. 113 if data[0] == 'None' or data[0] == 'str': 114 continue 115 116 # The argument test. 117 self.assertRaises(RelaxNoneStrError, self.n_state_model_fns.cone_pdb, cone_type='', dir=data[1])
118 119
121 """The force arg test of the n_state_model.cone_pdb() user function.""" 122 123 # Loop over the data types. 124 for data in DATA_TYPES: 125 # Catch the bool arguments, and skip them. 126 if data[0] == 'bool': 127 continue 128 129 # The argument test. 130 self.assertRaises(RelaxBoolError, self.n_state_model_fns.cone_pdb, cone_type='', force=data[1])
131 132
134 """Failure of the N arg of the n_state_model.number_of_states() user function.""" 135 136 # Loop over the data types. 137 for data in DATA_TYPES: 138 # Catch the bin and int arguments, and skip them. 139 if data[0] == 'bin' or data[0] == 'int': 140 continue 141 142 # The argument test. 143 self.assertRaises(RelaxIntError, self.n_state_model_fns.number_of_states, N=data[1])
144 145
147 """Failure of the ref arg of the n_state_model.ref_domain() user function.""" 148 149 # Loop over the data types. 150 for data in DATA_TYPES: 151 # Catch the str arguments, and skip them. 152 if data[0] == 'str': 153 continue 154 155 # The argument test. 156 self.assertRaises(RelaxStrError, self.n_state_model_fns.ref_domain, ref=data[1])
157 158
160 """Failure of the model arg of the n_state_model.select_model() user function.""" 161 162 # Loop over the data types. 163 for data in DATA_TYPES: 164 # Catch the str arguments, and skip them. 165 if data[0] == 'str': 166 continue 167 168 # The argument test. 169 self.assertRaises(RelaxStrError, self.n_state_model_fns.select_model, model=data[1])
170