@@ -46,8 +46,11 @@ def test_add_mul(left_array, right_array, opname, exp):
46
46
47
47
48
48
def test_sub (left_array , right_array ):
49
- with pytest .raises (TypeError ):
50
- # numpy points to ^ operator or logical_xor function instead
49
+ msg = (
50
+ r"numpy boolean subtract, the `-` operator, is (?:deprecated|not supported), "
51
+ r"use the bitwise_xor, the `\^` operator, or the logical_xor function instead\."
52
+ )
53
+ with pytest .raises (TypeError , match = msg ):
51
54
left_array - right_array
52
55
53
56
@@ -92,13 +95,27 @@ def test_error_invalid_values(data, all_arithmetic_operators):
92
95
ops = getattr (s , op )
93
96
94
97
# invalid scalars
95
- with pytest .raises (TypeError ):
98
+ msg = (
99
+ "did not contain a loop with signature matching types|"
100
+ "BooleanArray cannot perform the operation|"
101
+ "not supported for the input types, and the inputs could not be safely coerced "
102
+ "to any supported types according to the casting rule ''safe''"
103
+ )
104
+ with pytest .raises (TypeError , match = msg ):
96
105
ops ("foo" )
97
- with pytest .raises (TypeError ):
106
+ msg = (
107
+ r"unsupported operand type\(s\) for|"
108
+ "Concatenation operation is not implemented for NumPy arrays"
109
+ )
110
+ with pytest .raises (TypeError , match = msg ):
98
111
ops (pd .Timestamp ("20180101" ))
99
112
100
113
# invalid array-likes
101
114
if op not in ("__mul__" , "__rmul__" ):
102
115
# TODO(extension) numpy's mul with object array sees booleans as numbers
103
- with pytest .raises (TypeError ):
116
+ msg = (
117
+ r"unsupported operand type\(s\) for|can only concatenate str|"
118
+ "not all arguments converted during string formatting"
119
+ )
120
+ with pytest .raises (TypeError , match = msg ):
104
121
ops (pd .Series ("foo" , index = s .index ))
0 commit comments