Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/13218.doc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Pointed out in the :func:`pytest.approx` documentation that it considers booleans unequal to numeric zero or one.
9 changes: 9 additions & 0 deletions src/_pytest/python_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,15 @@ def approx(expected, rel=None, abs=None, nan_ok: bool = False) -> ApproxBase:
from the
`re_assert package <https://github.com/asottile/re-assert>`_.


.. note::

Unlike built-in equality, this function considers
booleans unequal to numeric zero or one. For example::

>>> 1 == approx(True)
False

.. warning::

.. versionchanged:: 3.2
Expand Down