Cherry pick release 8.1.2

This commit is contained in:
github-actions[bot] 2024-04-25 11:11:50 +00:00 committed by Bruno Oliveira
parent 4eb8b6d525
commit 4eacc866a6
3 changed files with 3 additions and 3 deletions

View File

@ -1 +0,0 @@
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

@ -163,7 +163,7 @@ class ApproxNumpy(ApproxBase):
self._approx_scalar, self.expected.tolist() self._approx_scalar, self.expected.tolist()
) )
# convert other_side to numpy array to ensure shape attribute is available # Convert other_side to numpy array to ensure shape attribute is available.
other_side_as_array = _as_numpy_array(other_side) other_side_as_array = _as_numpy_array(other_side)
assert other_side_as_array is not None assert other_side_as_array is not None

View File

@ -763,7 +763,8 @@ class TestApprox:
assert a12 != approx(a21) assert a12 != approx(a21)
assert a21 != approx(a12) assert a21 != approx(a12)
def test_numpy_array_implicit_conversion(self): def test_numpy_array_implicit_conversion(self) -> None:
"""#12114."""
np = pytest.importorskip("numpy") np = pytest.importorskip("numpy")
class ImplicitArray: class ImplicitArray: