summaryrefslogtreecommitdiff
path: root/numpy/testing/_private/nosetester.py
diff options
context:
space:
mode:
authorStephan Hoyer <shoyer@gmail.com>2019-01-01 22:50:29 -0800
committerGitHub <noreply@github.com>2019-01-01 22:50:29 -0800
commita16fc9499eaa7cc9d7532f8a51725c6ed647cd1b (patch)
treeb9df23e3024937390d00135616379fc266722339 /numpy/testing/_private/nosetester.py
parent43298265ab35b82e29ff772c466872a78531fabd (diff)
downloadnumpy-a16fc9499eaa7cc9d7532f8a51725c6ed647cd1b.tar.gz
ENH: add "max difference" messages to np.testing.assert_array_equal (#12591)
Example behavior: >>> x = np.array([1, 2, 3]) >>> y = np.array([1, 2, 3.0001]) >>> np.testing.assert_allclose(x, y) AssertionError: Not equal to tolerance rtol=1e-07, atol=0 Mismatch: 33.3% Max absolute difference: 0.0001 Max relative difference: 3.33322223e-05 x: array([1, 2, 3]) y: array([1. , 2. , 3.0001]) Motivation: when writing numerical algorithms, I frequently find myself experimenting to pick the right value of `atol` and `rtol` for `np.testing.assert_allclose()`. If I make the tolerance too generous, I risk missing regressions in accuracy, so I usually try to pick the smallest values for which tests pass. This change immediately reveals appropriate values to use for these parameters, so I don't need to guess and check.
Diffstat (limited to 'numpy/testing/_private/nosetester.py')
-rw-r--r--numpy/testing/_private/nosetester.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/numpy/testing/_private/nosetester.py b/numpy/testing/_private/nosetester.py
index 1728d9d1f..19569a509 100644
--- a/numpy/testing/_private/nosetester.py
+++ b/numpy/testing/_private/nosetester.py
@@ -92,7 +92,7 @@ def run_module_suite(file_to_run=None, argv=None):
Alternatively, calling::
- >>> run_module_suite(file_to_run="numpy/tests/test_matlib.py")
+ >>> run_module_suite(file_to_run="numpy/tests/test_matlib.py") # doctest: +SKIP
from an interpreter will run all the test routine in 'test_matlib.py'.
"""