1   
  2   
  3   
  4   
  5   
  6   
  7   
  8   
  9   
 10   
 11   
 12   
 13   
 14   
 15   
 16   
 17   
 18   
 19   
 20   
 21   
 22   
 23  from unittest import TestCase 
 24   
 25   
 26  from prompt.interpreter import Interpreter 
 27  from lib.errors import RelaxBoolError, RelaxIntError, RelaxListNumError, RelaxNoneListNumError, RelaxNoneStrError, RelaxNumError, RelaxStrError 
 28  from test_suite.unit_tests.n_state_model_testing_base import N_state_model_base_class 
 29   
 30   
 31  from test_suite.unit_tests._prompt.data_types import DATA_TYPES 
 32   
 33   
 35      """Unit tests for the functions of the 'prompt.n_state_model' module.""" 
 36   
 50   
 51   
 53          """The pivot_point arg test of the n_state_model.CoM() user function.""" 
 54   
 55           
 56          for data in DATA_TYPES: 
 57               
 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               
 62              self.assertRaises(RelaxListNumError, self.n_state_model_fns.CoM, pivot_point=data[1]) 
  63   
 64   
 66          """The centre arg test of the n_state_model.CoM() user function.""" 
 67   
 68           
 69          for data in DATA_TYPES: 
 70               
 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               
 75              self.assertRaises(RelaxNoneListNumError, self.n_state_model_fns.CoM, centre=data[1]) 
  76   
 77   
 79          """The cone_type arg test of the n_state_model.cone_pdb() user function.""" 
 80   
 81           
 82          for data in DATA_TYPES: 
 83               
 84              if data[0] == 'str': 
 85                  continue 
 86   
 87               
 88              self.assertRaises(RelaxStrError, self.n_state_model_fns.cone_pdb, cone_type=data[1]) 
  89   
 90   
 92          """The scale arg test of the n_state_model.cone_pdb() user function.""" 
 93   
 94           
 95          for data in DATA_TYPES: 
 96               
 97              if data[0] == 'float' or data[0] == 'bin' or data[0] == 'int': 
 98                  continue 
 99   
100               
101              self.assertRaises(RelaxNumError, self.n_state_model_fns.cone_pdb, cone_type='', scale=data[1]) 
 102   
103   
105          """The file arg test of the n_state_model.cone_pdb() user function.""" 
106   
107           
108          for data in DATA_TYPES: 
109               
110              if data[0] == 'str': 
111                  continue 
112   
113               
114              self.assertRaises(RelaxStrError, self.n_state_model_fns.cone_pdb, cone_type='', file=data[1]) 
 115   
116   
118          """The dir arg test of the n_state_model.cone_pdb() user function.""" 
119   
120           
121          for data in DATA_TYPES: 
122               
123              if data[0] == 'None' or data[0] == 'str': 
124                  continue 
125   
126               
127              self.assertRaises(RelaxNoneStrError, self.n_state_model_fns.cone_pdb, cone_type='', dir=data[1]) 
 128   
129   
131          """The force arg test of the n_state_model.cone_pdb() user function.""" 
132   
133           
134          for data in DATA_TYPES: 
135               
136              if data[0] == 'bool': 
137                  continue 
138   
139               
140              self.assertRaises(RelaxBoolError, self.n_state_model_fns.cone_pdb, cone_type='', force=data[1]) 
 141   
142   
144          """Failure of the N arg of the n_state_model.number_of_states() user function.""" 
145   
146           
147          for data in DATA_TYPES: 
148               
149              if data[0] == 'bin' or data[0] == 'int': 
150                  continue 
151   
152               
153              self.assertRaises(RelaxIntError, self.n_state_model_fns.number_of_states, N=data[1]) 
 154   
155   
157          """Failure of the ref arg of the n_state_model.ref_domain() user function.""" 
158   
159           
160          for data in DATA_TYPES: 
161               
162              if data[0] == 'str': 
163                  continue 
164   
165               
166              self.assertRaises(RelaxStrError, self.n_state_model_fns.ref_domain, ref=data[1]) 
 167   
168   
170          """Failure of the model arg of the n_state_model.select_model() user function.""" 
171   
172           
173          for data in DATA_TYPES: 
174               
175              if data[0] == 'str': 
176                  continue 
177   
178               
179              self.assertRaises(RelaxStrError, self.n_state_model_fns.select_model, model=data[1]) 
  180