Suggest numpy testing module on pytest approx docs (#8615)

Co-authored-by: Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com>
Co-authored-by: Tarcisio Fischer <tarcisio@esss.co>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
This commit is contained in:
Tarcísio Fischer 2021-05-04 23:08:41 -03:00 committed by GitHub
parent a62a28b4b8
commit b7416f7abd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

1
changelog/8337.doc.rst Normal file
View File

@ -0,0 +1 @@
Recommend `numpy.testing <https://numpy.org/doc/stable/reference/routines.testing.html>`__ module on :func:`pytest.approx` documentation.

View File

@ -654,6 +654,14 @@ def approx(expected, rel=None, abs=None, nan_ok: bool = False) -> ApproxBase:
special case that you explicitly specify an absolute tolerance but not a
relative tolerance, only the absolute tolerance is considered.
.. note::
``approx`` can handle numpy arrays, but we recommend the
specialised test helpers in `numpy.testing`__ if you need
support for comparisons, NaNs, or ULP-based tolerances.
__ https://numpy.org/doc/stable/reference/routines.testing.html
.. warning::
.. versionchanged:: 3.2