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, RelaxNoneIntError, RelaxNoneStrError, RelaxStrError
29 from test_suite.unit_tests.sequence_testing_base import Sequence_base_class
30
31
32 from data_types import DATA_TYPES
33
34
36 """Unit tests for the functions of the 'prompt.sequence' module."""
37
51
52
54 """The pipe_from arg test of the sequence.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.sequence_fns.copy, pipe_from=data[1])
64
65
67 """The pipe_to arg test of the sequence.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.sequence_fns.copy, pipe_to=data[1])
77
78
80 """The pipe_from and pipe_to arg test of the sequence.copy() user function."""
81
82
83 self.assertRaises(RelaxError, self.sequence_fns.copy)
84
85
87 """The proper failure of the sequence.display() user function for the sep argument."""
88
89
90 for data in DATA_TYPES:
91
92 if data[0] == 'None' or data[0] == 'str':
93 continue
94
95
96 self.assertRaises(RelaxNoneStrError, self.sequence_fns.display, sep=data[1])
97
98
100 """The proper failure of the sequence.display() user function for the mol_name_flag argument."""
101
102
103 for data in DATA_TYPES:
104
105 if data[0] == 'bool':
106 continue
107
108
109 self.assertRaises(RelaxBoolError, self.sequence_fns.display, mol_name_flag=data[1])
110
111
113 """The proper failure of the sequence.display() user function for the res_num_flag argument."""
114
115
116 for data in DATA_TYPES:
117
118 if data[0] == 'bool':
119 continue
120
121
122 self.assertRaises(RelaxBoolError, self.sequence_fns.display, res_num_flag=data[1])
123
124
126 """The proper failure of the sequence.display() user function for the res_name_flag argument."""
127
128
129 for data in DATA_TYPES:
130
131 if data[0] == 'bool':
132 continue
133
134
135 self.assertRaises(RelaxBoolError, self.sequence_fns.display, res_name_flag=data[1])
136
137
139 """The proper failure of the sequence.display() user function for the spin_num_flag argument."""
140
141
142 for data in DATA_TYPES:
143
144 if data[0] == 'bool':
145 continue
146
147
148 self.assertRaises(RelaxBoolError, self.sequence_fns.display, spin_num_flag=data[1])
149
150
152 """The proper failure of the sequence.display() user function for the spin_name_flag argument."""
153
154
155 for data in DATA_TYPES:
156
157 if data[0] == 'bool':
158 continue
159
160
161 self.assertRaises(RelaxBoolError, self.sequence_fns.display, spin_name_flag=data[1])
162
163
165 """Test the proper failure of the sequence.read() user function for the file argument."""
166
167
168 for data in DATA_TYPES:
169
170 if data[0] == 'str':
171 continue
172
173
174 self.assertRaises(RelaxStrError, self.sequence_fns.read, file=data[1])
175
176
178 """Test the proper failure of the sequence.read() user function for the dir argument."""
179
180
181 for data in DATA_TYPES:
182
183 if data[0] == 'None' or data[0] == 'str':
184 continue
185
186
187 self.assertRaises(RelaxNoneStrError, self.sequence_fns.read, file='a', dir=data[1])
188
189
191 """The proper failure of the sequence.read() user function for the mol_name_col argument."""
192
193
194 for data in DATA_TYPES:
195
196 if data[0] == 'None' or data[0] == 'int' or data[0] == 'bin':
197 continue
198
199
200 self.assertRaises(RelaxNoneIntError, self.sequence_fns.read, file='a', mol_name_col=data[1])
201
202
204 """The proper failure of the sequence.read() user function for the res_num_col argument."""
205
206
207 for data in DATA_TYPES:
208
209 if data[0] == 'None' or data[0] == 'int' or data[0] == 'bin':
210 continue
211
212
213 self.assertRaises(RelaxNoneIntError, self.sequence_fns.read, file='a', res_num_col=data[1])
214
215
217 """The proper failure of the sequence.read() user function for the res_name_col argument."""
218
219
220 for data in DATA_TYPES:
221
222 if data[0] == 'None' or data[0] == 'int' or data[0] == 'bin':
223 continue
224
225
226 self.assertRaises(RelaxNoneIntError, self.sequence_fns.read, file='a', res_name_col=data[1])
227
228
230 """The proper failure of the sequence.read() user function for the spin_num_col argument."""
231
232
233 for data in DATA_TYPES:
234
235 if data[0] == 'None' or data[0] == 'int' or data[0] == 'bin':
236 continue
237
238
239 self.assertRaises(RelaxNoneIntError, self.sequence_fns.read, file='a', spin_num_col=data[1])
240
241
243 """The proper failure of the sequence.read() user function for the spin_name_col argument."""
244
245
246 for data in DATA_TYPES:
247
248 if data[0] == 'None' or data[0] == 'int' or data[0] == 'bin':
249 continue
250
251
252 self.assertRaises(RelaxNoneIntError, self.sequence_fns.read, file='a', spin_name_col=data[1])
253
254
256 """The proper failure of the sequence.read() user function for the sep argument."""
257
258
259 for data in DATA_TYPES:
260
261 if data[0] == 'None' or data[0] == 'str':
262 continue
263
264
265 self.assertRaises(RelaxNoneStrError, self.sequence_fns.read, file='a', sep=data[1])
266
267
269 """Test the proper failure of the sequence.write() user function for the file argument."""
270
271
272 for data in DATA_TYPES:
273
274 if data[0] == 'str':
275 continue
276
277
278 self.assertRaises(RelaxStrError, self.sequence_fns.write, file=data[1])
279
280
282 """Test the proper failure of the sequence.write() user function for the dir argument."""
283
284
285 for data in DATA_TYPES:
286
287 if data[0] == 'None' or data[0] == 'str':
288 continue
289
290
291 self.assertRaises(RelaxNoneStrError, self.sequence_fns.write, file='a', dir=data[1])
292
293
295 """The proper failure of the sequence.write() user function for the mol_name_flag argument."""
296
297
298 for data in DATA_TYPES:
299
300 if data[0] == 'bool':
301 continue
302
303
304 self.assertRaises(RelaxBoolError, self.sequence_fns.write, file='a', mol_name_flag=data[1])
305
306
308 """The proper failure of the sequence.write() user function for the res_num_flag argument."""
309
310
311 for data in DATA_TYPES:
312
313 if data[0] == 'bool':
314 continue
315
316
317 self.assertRaises(RelaxBoolError, self.sequence_fns.write, file='a', res_num_flag=data[1])
318
319
321 """The proper failure of the sequence.write() user function for the res_name_flag argument."""
322
323
324 for data in DATA_TYPES:
325
326 if data[0] == 'bool':
327 continue
328
329
330 self.assertRaises(RelaxBoolError, self.sequence_fns.write, file='a', res_name_flag=data[1])
331
332
334 """The proper failure of the sequence.write() user function for the spin_num_flag argument."""
335
336
337 for data in DATA_TYPES:
338
339 if data[0] == 'bool':
340 continue
341
342
343 self.assertRaises(RelaxBoolError, self.sequence_fns.write, file='a', spin_num_flag=data[1])
344
345
347 """The proper failure of the sequence.write() user function for the spin_name_flag argument."""
348
349
350 for data in DATA_TYPES:
351
352 if data[0] == 'bool':
353 continue
354
355
356 self.assertRaises(RelaxBoolError, self.sequence_fns.write, file='a', spin_name_flag=data[1])
357
358
360 """The proper failure of the sequence.write() user function for the sep argument."""
361
362
363 for data in DATA_TYPES:
364
365 if data[0] == 'None' or data[0] == 'str':
366 continue
367
368
369 self.assertRaises(RelaxNoneStrError, self.sequence_fns.write, file='a', sep=data[1])
370
371
373 """The force arg test of the sequence.write() user function."""
374
375
376 for data in DATA_TYPES:
377
378 if data[0] == 'bool':
379 continue
380
381
382 self.assertRaises(RelaxBoolError, self.sequence_fns.write, file='a', force=data[1])
383