From 6fa6835aa9aee709422b4f1cca9f948b55e60bc5 Mon Sep 17 00:00:00 2001 From: poulami-sau <109125687+poulami-sau@users.noreply.github.com> Date: Sun, 21 Apr 2024 21:37:13 -0400 Subject: [PATCH] idk --- changelog/12114.bugfix.rst | 1 + testing/python/approx.py | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) create mode 100644 changelog/12114.bugfix.rst diff --git a/changelog/12114.bugfix.rst b/changelog/12114.bugfix.rst new file mode 100644 index 000000000..798496925 --- /dev/null +++ b/changelog/12114.bugfix.rst @@ -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. diff --git a/testing/python/approx.py b/testing/python/approx.py index 91cb666c5..875c89891 100644 --- a/testing/python/approx.py +++ b/testing/python/approx.py @@ -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):