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 RelaxNoneStrError, RelaxStrError
29 from test_suite.unit_tests.molecule_testing_base import Molecule_base_class
30
31
32 from data_types import DATA_TYPES
33
34
36 """Unit tests for the functions of the 'prompt.molecule' module."""
37
51
52
54 """Test the proper failure of the molecule.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.molecule_fns.copy, pipe_from=data[1], mol_from='#Old mol', mol_to='#Old mol')
64
65
67 """Test the proper failure of the molecule.copy() user function for the mol_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.molecule_fns.copy, mol_from=data[1], mol_to='#Old mol')
77
78
80 """Test the proper failure of the molecule.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.molecule_fns.copy, pipe_to=data[1], mol_from='#Old mol', mol_to='#New mol2')
90
91
93 """Test the proper failure of the molecule.copy() user function for the mol_to argument."""
94
95
96 self.setup_data()
97
98
99 for data in DATA_TYPES:
100
101 if data[0] == 'None' or data[0] == 'str':
102 continue
103
104
105 self.assertRaises(RelaxNoneStrError, self.molecule_fns.copy, mol_from='#Old mol', mol_to=data[1])
106
107
109 """Test the proper failure of the molecule.create() user function for the mol_name argument."""
110
111
112 for data in DATA_TYPES:
113
114 if data[0] == 'str':
115 continue
116
117
118 self.assertRaises(RelaxStrError, self.molecule_fns.create, mol_name=data[1])
119
120
122 """Test the proper failure of the molecule.delete() user function for the mol_id argument."""
123
124
125 for data in DATA_TYPES:
126
127 if data[0] == 'str':
128 continue
129
130
131 self.assertRaises(RelaxStrError, self.molecule_fns.delete, mol_id=data[1])
132
133
135 """Test the proper failure of the molecule.display() user function for the mol_id argument."""
136
137
138 for data in DATA_TYPES:
139
140 if data[0] == 'None' or data[0] == 'str':
141 continue
142
143
144 self.assertRaises(RelaxNoneStrError, self.molecule_fns.display, mol_id=data[1])
145
146
148 """Test the proper failure of the molecule.name() user function for the mol_id argument."""
149
150
151 for data in DATA_TYPES:
152
153 if data[0] == 'None' or data[0] == 'str':
154 continue
155
156
157 self.assertRaises(RelaxNoneStrError, self.molecule_fns.name, mol_id=data[1])
158
159
161 """Test the proper failure of the molecule.name() user function for the name argument."""
162
163
164 for data in DATA_TYPES:
165
166 if data[0] == 'str':
167 continue
168
169
170 self.assertRaises(RelaxStrError, self.molecule_fns.name, name=data[1])
171