Skip to content

Commit 9ea1744

Browse files
committed
add match=, remove test, add GH#61866 reference
1 parent 7454a7d commit 9ea1744

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

pandas/tests/arithmetic/test_numeric.py

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -857,31 +857,29 @@ def test_modulo_zero_int(self):
857857
tm.assert_series_equal(result, expected)
858858

859859
def test_np_array_mul_ea_array_returns_extensionarray(self):
860+
# GH#61866
860861
np_array = np.array([1, 2, 3, 4, 5], dtype=np.int64)
861862
ea_array = array([1, 2, 3, 4, 5], dtype="Int64")
862863
result = np_array * ea_array
863864
assert isinstance(result, type(ea_array))
864865
tm.assert_equal(result, array([1, 4, 9, 16, 25], dtype="Int64"))
865866

866-
def test_df_mul_np_and_ea_array_shape_and_errors(self):
867-
df = pd.DataFrame(np.arange(50).reshape(10, 5)).notna().values
868-
NP_array = np.array(list(range(10)), dtype=np.int64).reshape(10, 1)
869-
EA_array = array(list(range(10)), dtype="Int64").reshape(10, 1)
870-
result_np = df * NP_array
871-
assert isinstance(result_np, np.ndarray)
872-
tm.assert_equal(result_np.shape, (10, 5))
873-
874-
with pytest.raises(NotImplementedError):
875-
_ = df * EA_array
876-
877-
def test_non_1d_ea_raises_typeerror(self):
867+
def test_non_1d_ea_raises_notimplementederror(self):
868+
# GH#61866
878869
ea_array = array([1, 2, 3, 4, 5], dtype="Int64").reshape(5, 1)
879870
np_array = np.array([1, 2, 3, 4, 5], dtype=np.int64).reshape(5, 1)
880871

881-
with pytest.raises(NotImplementedError):
882-
_ = ea_array * np_array
883-
with pytest.raises(NotImplementedError):
884-
_ = np_array * ea_array
872+
with pytest.raises(
873+
NotImplementedError,
874+
match="non-1D ExtensionArray operations are not supported",
875+
):
876+
ea_array * np_array
877+
878+
with pytest.raises(
879+
NotImplementedError,
880+
match="non-1D ExtensionArray operations are not supported",
881+
):
882+
np_array * ea_array
885883

886884

887885
class TestAdditionSubtraction:

0 commit comments

Comments
 (0)