@@ -46,8 +46,11 @@ def test_add_mul(left_array, right_array, opname, exp):
4646
4747
4848def 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 ):
5154 left_array - right_array
5255
5356
@@ -92,13 +95,27 @@ def test_error_invalid_values(data, all_arithmetic_operators):
9295 ops = getattr (s , op )
9396
9497 # 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 ):
96105 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 ):
98111 ops (pd .Timestamp ("20180101" ))
99112
100113 # invalid array-likes
101114 if op not in ("__mul__" , "__rmul__" ):
102115 # 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 ):
104121 ops (pd .Series ("foo" , index = s .index ))
0 commit comments