Fix recursion in pytest.approx() with arrays in numpy<1.13

This commit is contained in:
Bruno Oliveira 2018-08-01 08:04:09 -03:00
parent 4588130c1e
commit 7d13599ba1
2 changed files with 2 additions and 1 deletions

View File

@ -0,0 +1 @@
Fix infinite recursion in ``pytest.approx`` with arrays in ``numpy<1.13``.

View File

@ -211,7 +211,7 @@ class ApproxScalar(ApproxBase):
the pre-specified tolerance. the pre-specified tolerance.
""" """
if _is_numpy_array(actual): if _is_numpy_array(actual):
return all(a == self for a in actual.flat) return all(self == a for a in actual.flat)
# Short-circuit exact equality. # Short-circuit exact equality.
if actual == self.expected: if actual == self.expected: