forked from pytest-dev/pytest
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use duck-typing to check for non-numeric types in approx()
Fix pytest-dev#8132
- Loading branch information
1 parent
7e2e663
commit e97863a
Showing
3 changed files
with
52 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Fixed regression in ``approx``: in 6.2.0 ``approx`` no longer raises | ||
``TypeError`` when dealing with non-numeric types, falling back to normal comparison, | ||
however the check was done using ``isinstance`` which left out types which implemented | ||
the necessary methods for ``approx`` to work, such as tensorflow's ``DeviceArray``. | ||
|
||
The code has been changed to check for the necessary methods to accommodate those cases. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters