Skip to content

Commit b3ee1aa

Browse files
Modernize test_base.py by replacing assert_almost_equal with assert_allclose per #3743
1 parent c86d287 commit b3ee1aa

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

testsuite/MDAnalysisTests/analysis/test_base.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import numpy as np
2828
import pytest
2929
from MDAnalysis.analysis import backends, base
30-
from numpy.testing import assert_allclose, assert_almost_equal, assert_equal
30+
from numpy.testing import assert_allclose, assert_equal
3131

3232
from MDAnalysisTests.datafiles import DCD, PSF, TPR, XTC
3333
from MDAnalysisTests.util import no_deprecated_call
@@ -279,7 +279,7 @@ def test_start_stop_step_parallel(u, run_kwargs, frames, client_FrameAnalysis):
279279
assert an.n_frames == len(frames)
280280
assert_equal(an.found_frames, frames)
281281
assert_equal(an.frames, frames, err_msg=FRAMES_ERR)
282-
assert_almost_equal(an.times, frames + 1, decimal=4, err_msg=TIMES_ERR)
282+
assert_allclose(an.times, frames + 1, rtol=0, atol=1e-4, err_msg=TIMES_ERR)
283283

284284

285285
def test_reset_n_parts_to_n_frames(u):
@@ -613,8 +613,8 @@ def test_AnalysisFromFunction_args_content(u, client_AnalysisFromFunction):
613613
ans = base.AnalysisFromFunction(mass_xyz, protein, another, masses)
614614
assert len(ans.args) == 3
615615
result = np.sum(ans.run(**client_AnalysisFromFunction).results.timeseries)
616-
assert_allclose(result, -317054.67757345125, rtol=0, atol=1.5e-6)
617-
assert_almost_equal(result, -317054.67757345125, decimal=6)
616+
assert_allclose(result, -317054.67757345125, rtol=0, atol=1e-6)
617+
assert_allclose(result, -317054.67757345125, rtol=0, atol=1e-6)
618618
assert (ans.args[0] is protein) and (ans.args[1] is another)
619619
assert ans._trajectory is protein.universe.trajectory
620620

@@ -652,4 +652,4 @@ def distance(a, b):
652652
Distances = base.analysis_class(distance)
653653

654654
with no_deprecated_call():
655-
d = Distances(u.atoms[:10], u.atoms[10:20]).run()
655+
d = Distances(u.atoms[:10], u.atoms[10:20]).run()

0 commit comments

Comments
 (0)