Apply suggestions from code review
This commit is contained in:
parent
3d5bebfd47
commit
dfa90bba2d
|
@ -1 +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.
|
||||
Fixed error in :func:`pytest.approx` when used with `numpy` arrays and comparing with other types.
|
||||
|
|
|
@ -163,7 +163,7 @@ class ApproxNumpy(ApproxBase):
|
|||
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)
|
||||
assert other_side_as_array is not None
|
||||
|
||||
|
|
|
@ -763,7 +763,8 @@ class TestApprox:
|
|||
assert a12 != approx(a21)
|
||||
assert a21 != approx(a12)
|
||||
|
||||
def test_numpy_array_implicit_conversion(self):
|
||||
def test_numpy_array_implicit_conversion(self) -> None:
|
||||
"""#12114."""
|
||||
np = pytest.importorskip("numpy")
|
||||
|
||||
class ImplicitArray:
|
||||
|
|
Loading…
Reference in New Issue