From c07752649fa96f4f0226e11cdbc67d8f3fd0d922 Mon Sep 17 00:00:00 2001 From: poulami-sau <109125687+poulami-sau@users.noreply.github.com> Date: Sun, 21 Apr 2024 20:40:46 -0400 Subject: [PATCH] added conversion of other_side to numpy array --- src/_pytest/python_api.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/_pytest/python_api.py b/src/_pytest/python_api.py index 0ba86e816..750769af7 100644 --- a/src/_pytest/python_api.py +++ b/src/_pytest/python_api.py @@ -163,6 +163,9 @@ class ApproxNumpy(ApproxBase): self._approx_scalar, self.expected.tolist() ) + # convert other_side to numpy array to ensure shape attribute is available + other_side = _as_numpy_array(other_side) + if np_array_shape != other_side.shape: return [ "Impossible to compare arrays with different shapes.",