This commit is contained in:
poulami-sau 2024-04-21 21:37:13 -04:00
parent b5ee309a2c
commit 6fa6835aa9
2 changed files with 1 additions and 2 deletions

View File

@ -0,0 +1 @@
Fixed attribute error in pytest.approx for types implicitly convertible to numpy arrays by converting other_side to a numpy array so that np_array_shape != other_side.shape can be properly checked.

View File

@ -773,12 +773,10 @@ class TestApprox:
self.vals = vals
def __array__(self, dtype=None, copy=None):
print("called __array__ in ImplicitArray")
return np.array(self.vals)
vec1 = ImplicitArray([1.0, 2.0, 3.0])
vec2 = ImplicitArray([1.0, 2.0, 4.0])
# see issue #12114 for test case
assert vec1 != approx(vec2)
def test_numpy_array_protocol(self):