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 RelaxError, RelaxBoolError, RelaxIntError, RelaxNoneStrError, RelaxNumError, RelaxNoneNumTupleNumError, RelaxStrError 
 28  from test_suite.unit_tests.diffusion_tensor_testing_base import Diffusion_tensor_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.diffusion_tensor' module.""" 
 36   
 50   
 51   
 53          """The pipe_from arg test of the diffusion_tensor.copy() user function.""" 
 54   
 55           
 56          for data in DATA_TYPES: 
 57               
 58              if data[0] == 'None' or data[0] == 'str': 
 59                  continue 
 60   
 61               
 62              self.assertRaises(RelaxNoneStrError, self.diffusion_tensor_fns.copy, pipe_from=data[1]) 
  63   
 64   
 66          """The pipe_to arg test of the diffusion_tensor.copy() user function.""" 
 67   
 68           
 69          for data in DATA_TYPES: 
 70               
 71              if data[0] == 'None' or data[0] == 'str': 
 72                  continue 
 73   
 74               
 75              self.assertRaises(RelaxNoneStrError, self.diffusion_tensor_fns.copy, pipe_to=data[1]) 
  76   
 77   
 79          """The pipe_from and pipe_to arg test of the diffusion_tensor.copy() user function.""" 
 80   
 81           
 82          self.assertRaises(RelaxError, self.diffusion_tensor_fns.copy) 
  83   
 84   
 86          """The params arg test of diffusion_tensor.init() user function.""" 
 87   
 88           
 89          for data in DATA_TYPES: 
 90               
 91              if data[0] == 'None' or data[0] == 'int' or data[0] == 'bin' or data[0] == 'float': 
 92                  continue 
 93   
 94               
 95              if data[0] == 'tuple' or data[0] == 'float tuple' or data[0] == 'str tuple': 
 96                   
 97                  if len(data[1]) == 4 or len(data[1]) == 6: 
 98                      continue 
 99   
100               
101              self.assertRaises(RelaxNoneNumTupleNumError, self.diffusion_tensor_fns.init, params=data[1]) 
 102   
103   
105          """The time_scale arg test of the diffusion_tensor.init() user function.""" 
106   
107           
108          for data in DATA_TYPES: 
109               
110              if data[0] == 'bin' or data[0] == 'int' or data[0] == 'float': 
111                  continue 
112   
113               
114              self.assertRaises(RelaxNumError, self.diffusion_tensor_fns.init, params=1e-9, time_scale=data[1]) 
 115   
116   
118          """The d_scale arg test of the diffusion_tensor.init() user function.""" 
119   
120           
121          for data in DATA_TYPES: 
122               
123              if data[0] == 'bin' or data[0] == 'int' or data[0] == 'float': 
124                  continue 
125   
126               
127              self.assertRaises(RelaxNumError, self.diffusion_tensor_fns.init, params=1e-9, d_scale=data[1]) 
 128   
129   
131          """The angle_units arg test of the diffusion_tensor.init() user function.""" 
132   
133           
134          for data in DATA_TYPES: 
135               
136              if data[0] == 'str': 
137                  continue 
138   
139               
140              self.assertRaises(RelaxStrError, self.diffusion_tensor_fns.init, params=1e-9, angle_units=data[1]) 
 141   
142   
144          """The param_types arg test of the diffusion_tensor.init() user function.""" 
145   
146           
147          for data in DATA_TYPES: 
148               
149              if data[0] == 'int' or data[0] == 'bin': 
150                  continue 
151   
152               
153              self.assertRaises(RelaxIntError, self.diffusion_tensor_fns.init, params=1e-9, param_types=data[1]) 
 154   
155   
157          """The spheroid_type arg test of the diffusion_tensor.init() user function.""" 
158   
159           
160          for data in DATA_TYPES: 
161               
162              if data[0] == 'None' or data[0] == 'str': 
163                  continue 
164   
165               
166              self.assertRaises(RelaxNoneStrError, self.diffusion_tensor_fns.init, params=1e-9, spheroid_type=data[1]) 
 167   
168   
170          """The fixed arg test of the diffusion_tensor.init() user function.""" 
171   
172           
173          for data in DATA_TYPES: 
174               
175              if data[0] == 'bool': 
176                  continue 
177   
178               
179              self.assertRaises(RelaxBoolError, self.diffusion_tensor_fns.init, params=1e-9, fixed=data[1]) 
  180