Skip to content

Commit 3968d72

Browse files
committed
Should always use np.allclose in tests, not ==
1 parent 4fef5c3 commit 3968d72

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tests/test_parameter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def test_uniform(self):
2727
x = 0.5
2828

2929
msg1 = "Enterprise and scipy priors do not match"
30-
assert UniformPrior(x, p_min, p_max) == scipy.stats.uniform.pdf(x, p_min, p_max - p_min), msg1
30+
assert np.allclose(UniformPrior(x, p_min, p_max), scipy.stats.uniform.pdf(x, p_min, p_max - p_min)), msg1
3131

3232
msg2 = "Enterprise samples have wrong value, type, or size"
3333
x1 = UniformSampler(p_min, p_max)
@@ -61,7 +61,7 @@ def test_linearexp(self):
6161
p_min, p_max = 1, 3
6262
x = 2
6363
msg1 = "Scalar prior does not match"
64-
assert LinearExpPrior(x, p_min, p_max) == np.log(10) * 10**2 / (10**3 - 10**1), msg1
64+
assert np.allclose(LinearExpPrior(x, p_min, p_max), np.log(10) * 10**2 / (10**3 - 10**1)), msg1
6565

6666
x = LinearExpSampler(p_min, p_max)
6767
msg1b = "Scalar sampler out of range"
@@ -95,7 +95,7 @@ def test_normal(self):
9595
x = 0.5
9696

9797
msg1 = "Enterprise and scipy priors do not match"
98-
assert NormalPrior(x, mu, sigma) == scipy.stats.multivariate_normal.pdf(x, mean=mu, cov=sigma**2), msg1
98+
assert np.allclose(NormalPrior(x, mu, sigma), scipy.stats.multivariate_normal.pdf(x, mean=mu, cov=sigma**2)), msg1
9999

100100
msg2 = "Enterprise samples have wrong value, type, or size"
101101
x1 = NormalSampler(mu, sigma)

0 commit comments

Comments
 (0)