diff options
author | Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> | 2021-04-13 23:54:54 +0200 |
---|---|---|
committer | Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> | 2021-04-13 23:54:54 +0200 |
commit | 80e4bf97bc54a70870b0f7e02101f0d6bef4147c (patch) | |
tree | 747e86d39c9e17a75f1ce407d35b9219e985b58c | |
parent | 4c780c2d4b35a54cf45ca7d931efcaca73d0bf24 (diff) | |
download | numpy-80e4bf97bc54a70870b0f7e02101f0d6bef4147c.tar.gz |
DOC: Use: from numpy.testing import ...
instead of `import numpy.testing as npt`.
- all of NumPy's own tests themselves use the from-import variant
- There's `import numpy.typing as npt` around in some places so
we should not abbreviate another module import with `npt`.
Optional further enhancement: If this is a convention we also want
users to adopt, this should be mentioned in the module docstring of
`numpy.testing`.
-rw-r--r-- | numpy/testing/_private/utils.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/numpy/testing/_private/utils.py b/numpy/testing/_private/utils.py index 1bdb00fd5..393fedc27 100644 --- a/numpy/testing/_private/utils.py +++ b/numpy/testing/_private/utils.py @@ -518,9 +518,9 @@ def assert_almost_equal(actual,desired,decimal=7,err_msg='',verbose=True): Examples -------- - >>> import numpy.testing as npt - >>> npt.assert_almost_equal(2.3333333333333, 2.33333334) - >>> npt.assert_almost_equal(2.3333333333333, 2.33333334, decimal=10) + >>> from numpy.testing import assert_almost_equal + >>> assert_almost_equal(2.3333333333333, 2.33333334) + >>> assert_almost_equal(2.3333333333333, 2.33333334, decimal=10) Traceback (most recent call last): ... AssertionError: @@ -528,8 +528,8 @@ def assert_almost_equal(actual,desired,decimal=7,err_msg='',verbose=True): ACTUAL: 2.3333333333333 DESIRED: 2.33333334 - >>> npt.assert_almost_equal(np.array([1.0,2.3333333333333]), - ... np.array([1.0,2.33333334]), decimal=9) + >>> assert_almost_equal(np.array([1.0,2.3333333333333]), + ... np.array([1.0,2.33333334]), decimal=9) Traceback (most recent call last): ... AssertionError: |