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, RelaxNoneIntError, RelaxNoneStrError, RelaxStrError
29 from test_suite.unit_tests.residue_testing_base import Residue_base_class
30
31
32 from data_types import DATA_TYPES
33
34
36 """Unit tests for the functions of the 'prompt.residue' module."""
37
51
52
54 """Test the proper failure of the residue.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.residue_fns.copy, pipe_from=data[1], res_from='#Old mol:1', res_to='#Old mol:2')
64
65
67 """Test the proper failure of the residue.copy() user function for the res_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.residue_fns.copy, res_from=data[1], res_to='#Old mol:2')
77
78
80 """Test the proper failure of the residue.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.residue_fns.copy, pipe_to=data[1], res_from='#Old mol:1', res_to='#Old mol:2')
90
91
93 """Test the proper failure of the residue.copy() user function for the res_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.residue_fns.copy, res_from='#Old mol:1@111', res_to=data[1])
103
104
106 """Test the proper failure of the residue.create() user function for the res_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.residue_fns.create, res_num=data[1], res_name='NH')
116
117
119 """Test the proper failure of the residue.create() user function for the res_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.residue_fns.create, res_name=data[1], res_num=1)
129
130
132 """Test the proper failure of the residue.create() user function for the mol_name argument."""
133
134
135 for data in DATA_TYPES:
136
137 if data[0] == 'None' or data[0] == 'str':
138 continue
139
140
141 self.assertRaises(RelaxNoneStrError, self.residue_fns.create, mol_name=data[1], res_num=1, res_name='NH')
142
143
145 """Test the proper failure of the residue.delete() user function for the res_id argument."""
146
147
148 for data in DATA_TYPES:
149
150 if data[0] == 'str':
151 continue
152
153
154 self.assertRaises(RelaxStrError, self.residue_fns.delete, res_id=data[1])
155
156
158 """Test the proper failure of the residue.display() user function for the res_id 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.residue_fns.display, res_id=data[1])
168
169
171 """Test the proper failure of the residue.name() user function for the res_id argument."""
172
173
174 for data in DATA_TYPES:
175
176 if data[0] == 'str':
177 continue
178
179
180 self.assertRaises(RelaxStrError, self.residue_fns.name, res_id=data[1])
181
182
184 """Test the proper failure of the residue.name() user function for the name argument."""
185
186
187 for data in DATA_TYPES:
188
189 if data[0] == 'str':
190 continue
191
192
193 self.assertRaises(RelaxStrError, self.residue_fns.name, name=data[1])
194
195
197 """Test the proper failure of the residue.number() user function for the res_id argument."""
198
199
200 for data in DATA_TYPES:
201
202 if data[0] == 'str':
203 continue
204
205
206 self.assertRaises(RelaxStrError, self.residue_fns.number, res_id=data[1])
207
208
210 """Test the proper failure of the residue.number() user function for the number argument."""
211
212
213 for data in DATA_TYPES:
214
215 if data[0] == 'int' or data[0] == 'bin':
216 continue
217
218
219 self.assertRaises(RelaxIntError, self.residue_fns.number, res_id=':1', number=data[1])
220