summaryrefslogtreecommitdiff
path: root/numpy/testing/_private/utils.py
diff options
context:
space:
mode:
authorSachin Krishnan T V <sachu92@gmail.com>2022-05-23 17:29:26 +0200
committerSachin Krishnan T V <sachu92@gmail.com>2022-05-23 17:29:26 +0200
commit2d1d3a60d1ce54a0a445453450f46ab998bab75d (patch)
tree47996149cc941ad07c9c21f68abcc3a58656ab17 /numpy/testing/_private/utils.py
parent4a2751cd89c44e5455b383392cc1794330998d90 (diff)
downloadnumpy-2d1d3a60d1ce54a0a445453450f46ab998bab75d.tar.gz
Improve docstring of numpy.testing.assert_allclose
Diffstat (limited to 'numpy/testing/_private/utils.py')
-rw-r--r--numpy/testing/_private/utils.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/numpy/testing/_private/utils.py b/numpy/testing/_private/utils.py
index 4a8f42e06..656afcb9c 100644
--- a/numpy/testing/_private/utils.py
+++ b/numpy/testing/_private/utils.py
@@ -1476,6 +1476,13 @@ def assert_allclose(actual, desired, rtol=1e-7, atol=0, equal_nan=True,
Raises an AssertionError if two objects are not equal up to desired
tolerance.
+ Given two array_like objects, check that the shape is equal and all
+ elements of these objects are equal (but see the Notes for the special
+ handling of a scalar). An exception is raised at shape mismatch or
+ conflicting values. In contrast to the standard usage in numpy, NaNs
+ are compared like numbers, no assertion is raised if both objects have
+ NaNs in the same positions.
+
The test is equivalent to ``allclose(actual, desired, rtol, atol)`` (note
that ``allclose`` has different default values). It compares the difference
between `actual` and `desired` to ``atol + rtol * abs(desired)``.
@@ -1508,6 +1515,12 @@ def assert_allclose(actual, desired, rtol=1e-7, atol=0, equal_nan=True,
--------
assert_array_almost_equal_nulp, assert_array_max_ulp
+ Notes
+ -----
+ When one of `actual` and `desired` is a scalar and the other is array_like,
+ the function checks that each element of the array_like object is equal to
+ the scalar.
+
Examples
--------
>>> x = [1e-5, 1e-3, 1e-1]