Skip to content

Commit 3b30d43

Browse files
committed
tests: modernize assertions in test_persistencelength (ref #3743)
1 parent cec335f commit 3b30d43

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

testsuite/MDAnalysisTests/analysis/test_persistencelength.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
import matplotlib
3232
import matplotlib.pyplot as plt
3333

34-
from numpy.testing import assert_almost_equal, assert_equal
34+
from numpy.testing import assert_equal
3535

3636
from MDAnalysisTests.datafiles import Plength, TRZ_psf, TRZ
3737

@@ -73,10 +73,10 @@ def test_run(self, p_run):
7373
assert len(p_run.results.bond_autocorrelation) == 280
7474

7575
def test_lb(self, p_run):
76-
assert_almost_equal(p_run.results.lb, 1.485, 3)
76+
assert p_run.results.lb == pytest.approx(1.485, abs=1e-3)
7777

7878
def test_fit(self, p_run):
79-
assert_almost_equal(p_run.results.lp, 6.504, 3)
79+
assert p_run.results.lp == pytest.approx(6.504, abs=1e-3)
8080
assert len(p_run.results.fit) == len(
8181
p_run.results.bond_autocorrelation
8282
)
@@ -124,7 +124,7 @@ def test_fit_noisy(self):
124124

125125
a = polymer.fit_exponential_decay(self.x, y2)
126126

127-
assert_almost_equal(a, self.a_ref, decimal=3)
127+
assert a == pytest.approx(self.a_ref, abs=1e-3)
128128
# assert np.rint(a) == self.a_ref
129129

130130

0 commit comments

Comments
 (0)