Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
bjodah committed Jan 13, 2025
1 parent 0a517a7 commit 72bf27d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions chempy/kinetics/tests/test__rates.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ def test_Log10TPolyMassAction__units():
p = MassAction(Constant(kunit)*10**ShiftedTPoly([273.15*u.K, .7, .02/u.K, .003/u.K**2, .0004/u.K**3]))
r = Reaction({'A': 2, 'B': 1}, {'C': 1}, p, {'B': 1})
res = p({'A': 11*u.molar, 'B': 13*u.molar, 'temperature': 298.15*u.K}, reaction=r)
ref = 10**(.7 + .02*25 + 0.003 * 25**2 + 0.0004 * 25**3)
assert abs(res - ref*13*11**2*Mps) < 1e-15
ref = 10**(.7 + .02*25 + 0.003 * 25**2 + 0.0004 * 25**3)*13*11**2*Mps
assert abs((res - ref)/ref) < 1e-15


def test_TPolyInLog10MassAction():
Expand Down
4 changes: 2 additions & 2 deletions chempy/tests/test_units.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def test_to_unitless():
sy.exp(Ea_over_RT_uncert)

T_K_sym = np.array(sy.Symbol('T_K', real=True), dtype=object) * u.K
to_unitless(T_K_sym/(298*u.K))
assert to_unitless(T_K_sym/(298*u.K)).tolist() == [sy.Symbol('T_K', real=True)]
rescale(simplified(Ea/dc.molar_gas_constant)/T_K_sym, 1)
Ea_over_R_uncert = UncertainQuantity(Ea, unit_of(Ea), 0.1*Ea)/dc.molar_gas_constant
to_unitless(Ea_over_R_uncert/(298*u.K))
Expand All @@ -223,7 +223,7 @@ def test_UncertainQuantity():
a = UncertainQuantity([1, 2], u.m, [.1, .2])
assert a[1] == [2.]*u.m
assert (-a)[0] == [-1.]*u.m
assert (-a).uncertainty[0] == [0.1]*u.m
assert allclose((-a).uncertainty[0], [0.1]*u.m)
assert (-a)[0] == (a*-1)[0]
assert (-a).uncertainty[0] == (a*-1).uncertainty[0]
assert allclose(a, [1, 2]*u.m)
Expand Down

0 comments on commit 72bf27d

Please sign in to comment.