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 RelaxIntError, RelaxListStrError, RelaxNoneIntError, RelaxNoneStrError, RelaxStrError
29 from test_suite.unit_tests.spin_testing_base import Spin_base_class
30
31
32 from data_types import DATA_TYPES
33
34
36 """Unit tests for the functions of the 'prompt.spin' module."""
37
51
52
54 """Test the proper failure of the spin.copy() user function for the pipe_from argument."""
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.spin_fns.copy, pipe_from=data[1], spin_from='#Old mol:1@111', spin_to='#Old mol:2')
64
65
67 """Test the proper failure of the spin.copy() user function for the spin_from argument."""
68
69
70 for data in DATA_TYPES:
71
72 if data[0] == 'str':
73 continue
74
75
76 self.assertRaises(RelaxStrError, self.spin_fns.copy, spin_from=data[1], spin_to='#Old mol:2')
77
78
80 """Test the proper failure of the spin.copy() user function for the pipe_to argument."""
81
82
83 for data in DATA_TYPES:
84
85 if data[0] == 'None' or data[0] == 'str':
86 continue
87
88
89 self.assertRaises(RelaxNoneStrError, self.spin_fns.copy, pipe_to=data[1], spin_from='#Old mol:1@111', spin_to='#Old mol:2')
90
91
93 """Test the proper failure of the spin.copy() user function for the spin_to argument."""
94
95
96 for data in DATA_TYPES:
97
98 if data[0] == 'None' or data[0] == 'str':
99 continue
100
101
102 self.assertRaises(RelaxNoneStrError, self.spin_fns.copy, spin_from='#Old mol:1@111', spin_to=data[1])
103
104
106 """Test the proper failure of the spin.create() user function for the spin_num argument."""
107
108
109 for data in DATA_TYPES:
110
111 if data[0] == 'None' or data[0] == 'int' or data[0] == 'bin':
112 continue
113
114
115 self.assertRaises(RelaxNoneIntError, self.spin_fns.create, spin_num=data[1], spin_name='NH')
116
117
119 """Test the proper failure of the spin.create() user function for the spin_name argument."""
120
121
122 for data in DATA_TYPES:
123
124 if data[0] == 'None' or data[0] == 'str':
125 continue
126
127
128 self.assertRaises(RelaxNoneStrError, self.spin_fns.create, spin_name=data[1], spin_num=1)
129
130
132 """Test the proper failure of the spin.create() user function for the res_num argument."""
133
134
135 for data in DATA_TYPES:
136
137 if data[0] == 'None' or data[0] == 'int' or data[0] == 'bin':
138 continue
139
140
141 self.assertRaises(RelaxNoneIntError, self.spin_fns.create, res_num=data[1], spin_name='NH')
142
143
145 """Test the proper failure of the spin.create() user function for the res_name argument."""
146
147
148 for data in DATA_TYPES:
149
150 if data[0] == 'None' or data[0] == 'str':
151 continue
152
153
154 self.assertRaises(RelaxNoneStrError, self.spin_fns.create, res_name=data[1], spin_num=1, spin_name='NH')
155
156
158 """Test the proper failure of the spin.create() user function for the mol_name argument."""
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.spin_fns.create, mol_name=data[1], spin_num=1, spin_name='NH')
168
169
171 """The spin_name arg test of the spin.create_pseudo() user function."""
172
173
174 for data in DATA_TYPES:
175
176 if data[0] == 'str':
177 continue
178
179
180 self.assertRaises(RelaxStrError, self.spin_fns.create_pseudo, spin_name=data[1])
181
182
184 """The spin_num arg test of the spin.create_pseudo() user function."""
185
186
187 for data in DATA_TYPES:
188
189 if data[0] == 'None' or data[0] == 'int' or data[0] == 'bin':
190 continue
191
192
193 self.assertRaises(RelaxNoneIntError, self.spin_fns.create_pseudo, spin_num=data[1], spin_name='Q')
194
195
197 """The res_id arg test of the spin.create_pseudo() user function."""
198
199
200 for data in DATA_TYPES:
201
202 if data[0] == 'None' or data[0] == 'str':
203 continue
204
205
206 self.assertRaises(RelaxNoneStrError, self.spin_fns.create_pseudo, res_id=data[1], spin_name='Q')
207
208
210 """The members arg test of the spin.create_pseudo() user function."""
211
212
213 for data in DATA_TYPES:
214
215 if data[0] == 'str list':
216 continue
217
218
219 self.assertRaises(RelaxListStrError, self.spin_fns.create_pseudo, members=data[1], spin_name='Q')
220
221
223 """The averaging arg test of the spin.create_pseudo() user function."""
224
225
226 for data in DATA_TYPES:
227
228 if data[0] == 'str':
229 continue
230
231
232 self.assertRaises(RelaxStrError, self.spin_fns.create_pseudo, averaging=data[1], spin_name='Q', members=['x'])
233
234
236 """Test the proper failure of the spin.delete() user function for the spin_id argument."""
237
238
239 for data in DATA_TYPES:
240
241 if data[0] == 'str':
242 continue
243
244
245 self.assertRaises(RelaxStrError, self.spin_fns.delete, spin_id=data[1])
246
247
259
260
272
273
275 """Test the proper failure of the spin.name() user function for the name argument."""
276
277
278 for data in DATA_TYPES:
279
280 if data[0] == 'str':
281 continue
282
283
284 self.assertRaises(RelaxStrError, self.spin_fns.name, name=data[1])
285
286
288 """Test the proper failure of the spin.number() user function for the spin_id argument."""
289
290
291 for data in DATA_TYPES:
292
293 if data[0] == 'None' or data[0] == 'str':
294 continue
295
296
297 self.assertRaises(RelaxNoneStrError, self.spin_fns.number, spin_id=data[1])
298
299
311