Skip to content

Commit 6a6fde1

Browse files
committed
issue 30999
1 parent 3d4f9dc commit 6a6fde1

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

pandas/tests/arrays/boolean/test_arithmetic.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,25 @@ class TestArithmeticOps(BaseOpsUtil):
1717
def test_error(self, data, all_arithmetic_operators):
1818
# invalid ops
1919

20-
op = all_arithmetic_operators
21-
s = pd.Series(data)
22-
ops = getattr(s, op)
23-
opa = getattr(data, op)
24-
25-
# invalid scalars
26-
with pytest.raises(TypeError):
20+
msg="invalid scalars"
21+
with pytest.raises(TypeError, match=msg):
2722
ops("foo")
28-
with pytest.raises(TypeError):
23+
with pytest.raises(TypeError, match=msg)
2924
ops(pd.Timestamp("20180101"))
3025

26+
3127
# invalid array-likes
32-
if op not in ("__mul__", "__rmul__"):
33-
# TODO(extension) numpy's mul with object array sees booleans as numbers
34-
with pytest.raises(TypeError):
35-
ops(pd.Series("foo", index=s.index))
28+
if op not in ("__mul__", "__rmul__"):
29+
# TODO(extension) numpy's mul with object array sees booleans as numbers
30+
msg="invalid array-likes,numpy's mul with object array sees booleans as numbers"
31+
with pytest.raises(TypeError, match=msg):
32+
ops(pd.Series("foo", index=s.index))
33+
3634

3735
# 2d
3836
result = opa(pd.DataFrame({"A": s}))
3937
assert result is NotImplemented
4038

41-
with pytest.raises(NotImplementedError):
39+
msg="invalid array-likes"
40+
with pytest.raises(NotImplementedError, match=msg):
4241
opa(np.arange(len(s)).reshape(-1, len(s)))

0 commit comments

Comments
 (0)