1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 from unittest import TestCase
25
26
27 from prompt.interpreter import Interpreter
28 from relax_errors import RelaxError, RelaxBoolError, RelaxIntError, RelaxNoneStrError, RelaxNumError, RelaxNumTupleNumError, RelaxStrError
29 from test_suite.unit_tests.diffusion_tensor_testing_base import Diffusion_tensor_base_class
30
31
32 from data_types import DATA_TYPES
33
34
36 """Unit tests for the functions of the 'prompt.diffusion_tensor' module."""
37
51
52
54 """The pipe_from arg test of the diffusion_tensor.copy() user function."""
55
56
57 for data in DATA_TYPES:
58
59 if data[0] == 'None' or data[0] == 'str':
60 continue
61
62
63 self.assertRaises(RelaxNoneStrError, self.diffusion_tensor_fns.copy, pipe_from=data[1])
64
65
67 """The pipe_to arg test of the diffusion_tensor.copy() user function."""
68
69
70 for data in DATA_TYPES:
71
72 if data[0] == 'None' or data[0] == 'str':
73 continue
74
75
76 self.assertRaises(RelaxNoneStrError, self.diffusion_tensor_fns.copy, pipe_to=data[1])
77
78
80 """The pipe_from and pipe_to arg test of the diffusion_tensor.copy() user function."""
81
82
83 self.assertRaises(RelaxError, self.diffusion_tensor_fns.copy)
84
85
87 """The params arg test of diffusion_tensor.init() user function."""
88
89
90 for data in DATA_TYPES:
91
92 if data[0] == 'int' or data[0] == 'bin' or data[0] == 'float':
93 continue
94
95
96 if data[0] == 'tuple' or data[0] == 'float tuple' or data[0] == 'str tuple':
97
98 if len(data[1]) == 4 or len(data[1]) == 6:
99 continue
100
101
102 self.assertRaises(RelaxNumTupleNumError, self.diffusion_tensor_fns.init, params=data[1])
103
104
106 """The time_scale arg test of the diffusion_tensor.init() user function."""
107
108
109 for data in DATA_TYPES:
110
111 if data[0] == 'bin' or data[0] == 'int' or data[0] == 'float':
112 continue
113
114
115 self.assertRaises(RelaxNumError, self.diffusion_tensor_fns.init, params=1e-9, time_scale=data[1])
116
117
119 """The d_scale arg test of the diffusion_tensor.init() user function."""
120
121
122 for data in DATA_TYPES:
123
124 if data[0] == 'bin' or data[0] == 'int' or data[0] == 'float':
125 continue
126
127
128 self.assertRaises(RelaxNumError, self.diffusion_tensor_fns.init, params=1e-9, d_scale=data[1])
129
130
132 """The angle_units arg test of the diffusion_tensor.init() user function."""
133
134
135 for data in DATA_TYPES:
136
137 if data[0] == 'str':
138 continue
139
140
141 self.assertRaises(RelaxStrError, self.diffusion_tensor_fns.init, params=1e-9, angle_units=data[1])
142
143
145 """The param_types arg test of the diffusion_tensor.init() user function."""
146
147
148 for data in DATA_TYPES:
149
150 if data[0] == 'int' or data[0] == 'bin':
151 continue
152
153
154 self.assertRaises(RelaxIntError, self.diffusion_tensor_fns.init, params=1e-9, param_types=data[1])
155
156
158 """The spheroid_type arg test of the diffusion_tensor.init() user function."""
159
160
161 for data in DATA_TYPES:
162
163 if data[0] == 'None' or data[0] == 'str':
164 continue
165
166
167 self.assertRaises(RelaxNoneStrError, self.diffusion_tensor_fns.init, params=1e-9, spheroid_type=data[1])
168
169
171 """The fixed arg test of the diffusion_tensor.init() user function."""
172
173
174 for data in DATA_TYPES:
175
176 if data[0] == 'bool':
177 continue
178
179
180 self.assertRaises(RelaxBoolError, self.diffusion_tensor_fns.init, params=1e-9, fixed=data[1])
181