-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
type: bugproblem that needs to be addressedproblem that needs to be addressed
Description
Hopefully, I'm not missing something obvious here.
Absolute and relative tolerance arguments or logic seem to get flipped when the comparison is against a np.array
Think I've tracked it down to this line.
pytest/src/_pytest/python_api.py
Line 214 in f93995e
return ApproxNumpy(actual, self.abs, self.rel, self.nan_ok) == self.expected |
abs
and rel
arguments should be in the other order according to the ApproxBase.__init__
pytest/src/_pytest/python_api.py
Line 46 in f93995e
def __init__(self, expected, rel=None, abs=None, nan_ok=False): |
pytest.__version__
'3.6.3'
np.__version__
'1.13.1'
abs_check = pytest.approx(100, abs=0.1, rel=0)
rel_check = pytest.approx(100, abs=0, rel=0.1)
99 == abs_check
# False
np.array(99) == abs_check
# True
99 == rel_check
# True
np.array(99) == rel_check
# False
Metadata
Metadata
Assignees
Labels
type: bugproblem that needs to be addressedproblem that needs to be addressed