Skip to content

Commit 4cca1d8

Browse files
Fixes #3743: Modernize test assertions in test_base.py (#4951)
1 parent 1cdb055 commit 4cca1d8

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

package/AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ Chronological list of authors
254254
- Yu-Yuan (Stuart) Yang
255255
- James Rowe
256256
- Debasish Mohanty
257+
- Abdulrahman Elbanna
257258

258259

259260
External code

package/CHANGELOG

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The rules for this file:
1414

1515

1616
-------------------------------------------------------------------------------
17-
??/??/?? IAlibay, orbeckst, BHM-Bob, TRY-ER
17+
??/??/?? IAlibay, orbeckst, BHM-Bob, TRY-ER, Abdulrahman-PROG
1818

1919

2020
* 2.10.0

testsuite/MDAnalysisTests/analysis/test_base.py

Lines changed: 3 additions & 3 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):
@@ -614,7 +614,7 @@ def test_AnalysisFromFunction_args_content(u, client_AnalysisFromFunction):
614614
assert len(ans.args) == 3
615615
result = np.sum(ans.run(**client_AnalysisFromFunction).results.timeseries)
616616
assert_allclose(result, -317054.67757345125, rtol=0, atol=1.5e-6)
617-
assert_almost_equal(result, -317054.67757345125, decimal=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

0 commit comments

Comments
 (0)