forked from pytest-dev/pytest
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
python_api: handle array-like args in approx() (pytest-dev#8137)
- Loading branch information
1 parent
8b8b121
commit 8354995
Showing
3 changed files
with
67 additions
and
6 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,10 @@ | ||
Fixed regression in ``approx``: in 6.2.0 ``approx`` no longer raises | ||
``TypeError`` when dealing with non-numeric types, falling back to normal comparison. | ||
Before 6.2.0, array types like tf.DeviceArray fell through to the scalar case, | ||
and happened to compare correctly to a scalar if they had only one element. | ||
After 6.2.0, these types began failing, because they inherited neither from | ||
standard Python number hierarchy nor from ``numpy.ndarray``. | ||
|
||
``approx`` now converts arguments to ``numpy.ndarray`` if they expose the array | ||
protocol and are not scalars. This treats array-like objects like numpy arrays, | ||
regardless of size. |
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