Skip to content

Commit 9551dec

Browse files
committed
Clean up remaining tests in arkane/commonTest.py
This was harder to read, parse, understand, or maintain. Also added a few extra asserts (units etc.)
1 parent f65203b commit 9551dec

File tree

1 file changed

+16
-31
lines changed

1 file changed

+16
-31
lines changed

test/arkane/commonTest.py

Lines changed: 16 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -115,61 +115,44 @@ def setup_class(cls):
115115
pdepjob.active_j_rotor = True
116116
network = pdepjob.network
117117
cls.network = network
118-
cls.Nisom = len(network.isomers)
119-
cls.Nreac = len(network.reactants)
120-
cls.Nprod = len(network.products)
121-
cls.Npath = len(network.path_reactions)
122-
cls.PathReaction2 = network.path_reactions[2]
123-
cls.TminValue = pdepjob.Tmin.value
124-
cls.Tmaxvalue = pdepjob.Tmax.value
125-
cls.TmaxUnits = pdepjob.Tmax.units
126-
cls.TlistValue = pdepjob.Tlist.value
127-
cls.PminValue = pdepjob.Pmin.value
128-
cls.Pcount = pdepjob.Pcount
129-
cls.Tcount = pdepjob.Tcount
130-
cls.GenTlist = pdepjob.generate_T_list()
131-
cls.PlistValue = pdepjob.Plist.value
132-
cls.maximum_grain_size_value = pdepjob.maximum_grain_size.value
133-
cls.method = pdepjob.method
134-
cls.rmgmode = pdepjob.rmgmode
135118

136119
# test Arkane's interactions with the network module
137120
def test_num_isom(self):
138121
"""
139122
Test the number of isomers identified.
140123
"""
141-
assert self.Nisom == 2
124+
assert len(self.network.isomers) == 2
142125

143126
def test_num_reac(self):
144127
"""
145128
Test the number of reactants identified.
146129
"""
147-
assert self.Nreac == 1
130+
assert len(self.network.reactants) == 1
148131

149132
def test_num_prod(self):
150133
"""
151134
Test the number of products identified.
152135
"""
153-
assert self.Nprod == 1
136+
assert len(self.network.products) == 1
154137

155138
def test_n_path_reactions(self):
156139
"""
157140
Test the whether or not RMG mode is turned on.
158141
"""
159-
assert self.Npath == 3
142+
assert len(self.network.path_reactions) == 3
160143

161144
def test_path_reactions(self):
162145
"""
163146
Test a path reaction label
164147
"""
165-
assert str(self.PathReaction2) == "CH2OH <=> methoxy"
148+
assert str(self.network.path_reactions[2]) == "CH2OH <=> methoxy"
166149

167150
# test Arkane's interactions with the pdep module
168151
def test_temperatures_units(self):
169152
"""
170153
Test the Temperature Units.
171154
"""
172-
assert str(self.TmaxUnits) == "K"
155+
assert str(self.pdepjob.Tmax.units) == "K"
173156

174157
def test_temperatures_limits(self):
175158
"""
@@ -182,7 +165,7 @@ def test_temperatures_list(self):
182165
"""
183166
Test the temperature list.
184167
"""
185-
assert np.array_equal(self.TlistValue, np.array([450, 500, 678, 700]))
168+
assert np.array_equal(self.pdepjob.Tlist.value_si, np.array([450, 500, 678, 700]))
186169

187170
def test_pressure_limits(self):
188171
"""
@@ -195,43 +178,45 @@ def test_pressure_count(self):
195178
"""
196179
Test the number pressures specified.
197180
"""
198-
assert self.Pcount == 7
181+
assert self.pdepjob.Pcount == 7
199182

200183
def test_temperature_count(self):
201184
"""
202185
Test the number temperatures specified.
203186
"""
204-
assert self.Tcount == 4
187+
assert self.pdepjob.Tcount == 4
205188

206189
def test_pressure_list(self):
207190
"""
208191
Test the pressure list.
209192
"""
210-
assert np.array_equal(self.PlistValue, np.array([0.01, 0.1, 1, 3, 10, 100, 1000]))
193+
assert np.array_equal(self.pdepjob.Plist.value, np.array([0.01, 0.1, 1, 3, 10, 100, 1000]))
194+
assert self.pdepjob.Plist.units == 'atm'
211195

212196
def test_generate_temperature_list(self):
213197
"""
214198
Test the generated temperature list.
215199
"""
216-
assert list(self.GenTlist) == [450.0, 500.0, 678.0, 700.0]
200+
assert list(self.pdepjob.generate_T_list()) == [450.0, 500.0, 678.0, 700.0]
217201

218202
def test_maximum_grain_size_value(self):
219203
"""
220204
Test the max grain size value.
221205
"""
222-
assert self.maximum_grain_size_value == 0.5
206+
assert self.pdepjob.maximum_grain_size.value == 0.5
207+
assert self.pdepjob.maximum_grain_size.units == 'kcal/mol'
223208

224209
def test_method(self):
225210
"""
226211
Test the master equation solution method chosen.
227212
"""
228-
assert self.method == "modified strong collision"
213+
assert self.pdepjob.method == "modified strong collision"
229214

230215
def test_rmg_mode(self):
231216
"""
232217
Test the whether or not RMG mode is turned on.
233218
"""
234-
assert self.rmgmode == False
219+
assert self.pdepjob.rmgmode == False
235220

236221
# Test Arkane's interactions with the kinetics module
237222
def test_calculate_tst_rate_coefficient(self):

0 commit comments

Comments
 (0)