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.residue import Residue
28 from relax_errors import RelaxIntError, 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
38
39 residue_fns = Residue()
40
41
43 """Test the proper failure of the residue.copy() user function for the pipe_from argument."""
44
45
46 for data in DATA_TYPES:
47
48 if data[0] == 'None' or data[0] == 'str':
49 continue
50
51
52 self.assertRaises(RelaxNoneStrError, self.residue_fns.copy, pipe_from=data[1], res_from='#Old mol:1', res_to='#Old mol:2')
53
54
56 """Test the proper failure of the residue.copy() user function for the res_from argument."""
57
58
59 for data in DATA_TYPES:
60
61 if data[0] == 'str':
62 continue
63
64
65 self.assertRaises(RelaxStrError, self.residue_fns.copy, res_from=data[1], res_to='#Old mol:2')
66
67
69 """Test the proper failure of the residue.copy() user function for the pipe_to argument."""
70
71
72 for data in DATA_TYPES:
73
74 if data[0] == 'None' or data[0] == 'str':
75 continue
76
77
78 self.assertRaises(RelaxNoneStrError, self.residue_fns.copy, pipe_to=data[1], res_from='#Old mol:1', res_to='#Old mol:2')
79
80
82 """Test the proper failure of the residue.copy() user function for the res_to argument."""
83
84
85 for data in DATA_TYPES:
86
87 if data[0] == 'None' or data[0] == 'str':
88 continue
89
90
91 self.assertRaises(RelaxNoneStrError, self.residue_fns.copy, res_from='#Old mol:1@111', res_to=data[1])
92
93
95 """Test the proper failure of the residue.create() user function for the res_num argument."""
96
97
98 for data in DATA_TYPES:
99
100 if data[0] == 'int' or data[0] == 'bin':
101 continue
102
103
104 self.assertRaises(RelaxIntError, self.residue_fns.create, res_num=data[1], res_name='NH')
105
106
108 """Test the proper failure of the residue.create() user function for the res_name argument."""
109
110
111 for data in DATA_TYPES:
112
113 if data[0] == 'None' or data[0] == 'str':
114 continue
115
116
117 self.assertRaises(RelaxNoneStrError, self.residue_fns.create, res_name=data[1], res_num=1)
118
119
121 """Test the proper failure of the residue.create() user function for the mol_name argument."""
122
123
124 for data in DATA_TYPES:
125
126 if data[0] == 'None' or data[0] == 'str':
127 continue
128
129
130 self.assertRaises(RelaxNoneStrError, self.residue_fns.create, mol_name=data[1], res_num=1, res_name='NH')
131
132
134 """Test the proper failure of the residue.delete() user function for the res_id argument."""
135
136
137 for data in DATA_TYPES:
138
139 if data[0] == 'str':
140 continue
141
142
143 self.assertRaises(RelaxStrError, self.residue_fns.delete, res_id=data[1])
144
145
157
158
160 """Test the proper failure of the residue.name() user function for the res_id argument."""
161
162
163 for data in DATA_TYPES:
164
165 if data[0] == 'str':
166 continue
167
168
169 self.assertRaises(RelaxStrError, self.residue_fns.name, res_id=data[1])
170
171
183
184
186 """Test the proper failure of the residue.number() user function for the res_id argument."""
187
188
189 for data in DATA_TYPES:
190
191 if data[0] == 'str':
192 continue
193
194
195 self.assertRaises(RelaxStrError, self.residue_fns.number, res_id=data[1])
196
197
209