Skip to content

Commit

Permalink
TST: add rtol and atol to assert_allclose_safely
Browse files Browse the repository at this point in the history
Allow rtol, atol for wrapper around ``allclose``.
  • Loading branch information
matthew-brett committed Feb 25, 2016
1 parent 796f63e commit e1795b9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nibabel/testing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def assert_dt_equal(a, b):
assert_equal(np.dtype(a).str, np.dtype(b).str)


def assert_allclose_safely(a, b, match_nans=True):
def assert_allclose_safely(a, b, match_nans=True, rtol=1e-5, atol=1e-8):
""" Allclose in integers go all wrong for large integers
"""
a = np.atleast_1d(a) # 0d arrays cannot be indexed
Expand All @@ -57,7 +57,7 @@ def assert_allclose_safely(a, b, match_nans=True):
a = a.astype(float)
if b.dtype.kind in 'ui':
b = b.astype(float)
assert_true(np.allclose(a, b))
assert_true(np.allclose(a, b, rtol=rtol, atol=atol))


def assert_re_in(regex, c, flags=0):
Expand Down

0 comments on commit e1795b9

Please sign in to comment.