-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
status: criticalgrave problem or usability issue that affects lots of usersgrave problem or usability issue that affects lots of userstype: regressionindicates a problem that was introduced in a release which was working previouslyindicates a problem that was introduced in a release which was working previously
Description
When comparing numpy.float64
with float
using pytest.approx
we reach maximum recursion. It works in pytest 3.5.0
and 3.6.0
thou.
Run on Ubuntu 16.04, python 3.5.2, numpy 1.11.3
It seems that changing
return all(a == self for a in actual.flat)
to
return all(self == a for a in actual.flat)
in pytest_api.py
file fixes the issue (see the bottom of traceback below).
import pytest
import numpy as np
val = np.float64(1.0)
val_to_cmp = 1.0
val == pytest.approx(val_to_cmp)
RecursionError Traceback (most recent call last)
<ipython-input-8-b44e412779ee> in <module>()
----> 1 val == pytest.approx(val_to_cmp)
~/venvs/dl3/lib/python3.5/site-packages/_pytest/python_api.py in __eq__(self, actual)
212 """
213 if _is_numpy_array(actual):
--> 214 return all(a == self for a in actual.flat)
215
216 # Short-circuit exact equality.
~/venvs/dl3/lib/python3.5/site-packages/_pytest/python_api.py in <genexpr>(.0)
212 """
213 if _is_numpy_array(actual):
--> 214 return all(a == self for a in actual.flat)
215
216 # Short-circuit exact equality.
... last 2 frames repeated, from the frame below ...
~/venvs/dl3/lib/python3.5/site-packages/_pytest/python_api.py in __eq__(self, actual)
212 """
213 if _is_numpy_array(actual):
--> 214 return all(a == self for a in actual.flat)
215
216 # Short-circuit exact equality.
RecursionError: maximum recursion depth exceeded while calling a Python object
Metadata
Metadata
Assignees
Labels
status: criticalgrave problem or usability issue that affects lots of usersgrave problem or usability issue that affects lots of userstype: regressionindicates a problem that was introduced in a release which was working previouslyindicates a problem that was introduced in a release which was working previously