Skip to content

Commit

Permalink
Suggest numpy testing module on pytest approx docs (pytest-dev#8615)
Browse files Browse the repository at this point in the history
Co-authored-by: Zac Hatfield-Dodds <[email protected]>
Co-authored-by: Tarcisio Fischer <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Bruno Oliveira <[email protected]>
  • Loading branch information
5 people authored May 5, 2021
1 parent a62a28b commit b7416f7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog/8337.doc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Recommend `numpy.testing <https://numpy.org/doc/stable/reference/routines.testing.html>`__ module on :func:`pytest.approx` documentation.
8 changes: 8 additions & 0 deletions src/_pytest/python_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b7416f7

Please sign in to comment.