summaryrefslogtreecommitdiff
path: root/tools/refguide_check.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 /tools/refguide_check.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 'tools/refguide_check.py')
-rw-r--r--tools/refguide_check.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/refguide_check.py b/tools/refguide_check.py
index 3d885e37f..fec715f63 100644
--- a/tools/refguide_check.py
+++ b/tools/refguide_check.py
@@ -76,6 +76,7 @@ PUBLIC_SUBMODULES = [
'polynomial',
'matrixlib',
'random',
+ 'testing',
]
# Docs for these modules are included in the parent module