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 RelaxListStrError, RelaxNoneIntError, RelaxNoneStrError, RelaxStrError
28 from test_suite.unit_tests.spin_testing_base import Spin_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.spin' module."""
36
50
51
53 """Test the proper failure of the spin.copy() user function for the pipe_from argument."""
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.spin_fns.copy, pipe_from=data[1], spin_from='#Old mol:1@111', spin_to='#Old mol:2')
63
64
66 """Test the proper failure of the spin.copy() user function for the spin_from argument."""
67
68
69 for data in DATA_TYPES:
70
71 if data[0] == 'str':
72 continue
73
74
75 self.assertRaises(RelaxStrError, self.spin_fns.copy, spin_from=data[1], spin_to='#Old mol:2')
76
77
79 """Test the proper failure of the spin.copy() user function for the pipe_to argument."""
80
81
82 for data in DATA_TYPES:
83
84 if data[0] == 'None' or data[0] == 'str':
85 continue
86
87
88 self.assertRaises(RelaxNoneStrError, self.spin_fns.copy, pipe_to=data[1], spin_from='#Old mol:1@111', spin_to='#Old mol:2')
89
90
92 """Test the proper failure of the spin.copy() user function for the spin_to argument."""
93
94
95 for data in DATA_TYPES:
96
97 if data[0] == 'None' or data[0] == 'str':
98 continue
99
100
101 self.assertRaises(RelaxNoneStrError, self.spin_fns.copy, spin_from='#Old mol:1@111', spin_to=data[1])
102
103
105 """Test the proper failure of the spin.create() user function for the spin_num argument."""
106
107
108 for data in DATA_TYPES:
109
110 if data[0] == 'None' or data[0] == 'int' or data[0] == 'bin':
111 continue
112
113
114 self.assertRaises(RelaxNoneIntError, self.spin_fns.create, spin_num=data[1], spin_name='NH')
115
116
118 """Test the proper failure of the spin.create() user function for the spin_name argument."""
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.spin_fns.create, spin_name=data[1], spin_num=1)
128
129
131 """Test the proper failure of the spin.create() user function for the res_num argument."""
132
133
134 for data in DATA_TYPES:
135
136 if data[0] == 'None' or data[0] == 'int' or data[0] == 'bin':
137 continue
138
139
140 self.assertRaises(RelaxNoneIntError, self.spin_fns.create, res_num=data[1], spin_name='NH')
141
142
144 """Test the proper failure of the spin.create() user function for the res_name argument."""
145
146
147 for data in DATA_TYPES:
148
149 if data[0] == 'None' or data[0] == 'str':
150 continue
151
152
153 self.assertRaises(RelaxNoneStrError, self.spin_fns.create, res_name=data[1], spin_num=1, spin_name='NH')
154
155
157 """Test the proper failure of the spin.create() user function for the mol_name argument."""
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.spin_fns.create, mol_name=data[1], spin_num=1, spin_name='NH')
167
168
170 """The spin_name arg test of the spin.create_pseudo() 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.spin_fns.create_pseudo, spin_name=data[1])
180
181
183 """The spin_num arg test of the spin.create_pseudo() user function."""
184
185
186 for data in DATA_TYPES:
187
188 if data[0] == 'None' or data[0] == 'int' or data[0] == 'bin':
189 continue
190
191
192 self.assertRaises(RelaxNoneIntError, self.spin_fns.create_pseudo, spin_num=data[1], spin_name='Q')
193
194
196 """The res_id arg test of the spin.create_pseudo() user function."""
197
198
199 for data in DATA_TYPES:
200
201 if data[0] == 'None' or data[0] == 'str':
202 continue
203
204
205 self.assertRaises(RelaxNoneStrError, self.spin_fns.create_pseudo, res_id=data[1], spin_name='Q')
206
207
209 """The members arg test of the spin.create_pseudo() user function."""
210
211
212 for data in DATA_TYPES:
213
214 if data[0] == 'str list':
215 continue
216
217
218 self.assertRaises(RelaxListStrError, self.spin_fns.create_pseudo, members=data[1], spin_name='Q')
219
220
222 """The averaging arg test of the spin.create_pseudo() user function."""
223
224
225 for data in DATA_TYPES:
226
227 if data[0] == 'str':
228 continue
229
230
231 self.assertRaises(RelaxStrError, self.spin_fns.create_pseudo, averaging=data[1], spin_name='Q', members=['x'])
232
233
235 """Test the proper failure of the spin.delete() user function for the spin_id argument."""
236
237
238 for data in DATA_TYPES:
239
240 if data[0] == 'str':
241 continue
242
243
244 self.assertRaises(RelaxStrError, self.spin_fns.delete, spin_id=data[1])
245
246
258
259
271
272
274 """Test the proper failure of the spin.name() user function for the name argument."""
275
276
277 for data in DATA_TYPES:
278
279 if data[0] == 'str':
280 continue
281
282
283 self.assertRaises(RelaxStrError, self.spin_fns.name, name=data[1])
284
285
287 """Test the proper failure of the spin.number() user function for the spin_id argument."""
288
289
290 for data in DATA_TYPES:
291
292 if data[0] == 'None' or data[0] == 'str':
293 continue
294
295
296 self.assertRaises(RelaxNoneStrError, self.spin_fns.number, spin_id=data[1])
297
298
310