@@ -178,25 +178,9 @@ def test_error_invalid_values(data, all_arithmetic_operators):
178178 ops = getattr (s , op )
179179
180180 # invalid scalars
181- msg = "|" .join (
182- [
183- r"can only perform ops with numeric values" ,
184- r"IntegerArray cannot perform the operation mod" ,
185- r"unsupported operand type" ,
186- r"can only concatenate str \(not \"int\"\) to str" ,
187- "not all arguments converted during string" ,
188- "ufunc '.*' not supported for the input types, and the inputs could not" ,
189- "ufunc '.*' did not contain a loop with signature matching types" ,
190- "Addition/subtraction of integers and integer-arrays with Timestamp" ,
191- "has no kernel" ,
192- "not implemented" ,
193- "The 'out' kwarg is necessary. Use numpy.strings.multiply without it." ,
194- "not supported for dtype" ,
195- ]
196- )
197- with pytest .raises (TypeError , match = msg ):
181+ with tm .external_error_raised (TypeError ):
198182 ops ("foo" )
199- with pytest . raises (TypeError , match = msg ):
183+ with tm . external_error_raised (TypeError ):
200184 ops (pd .Timestamp ("20180101" ))
201185
202186 # invalid array-likes
@@ -214,25 +198,10 @@ def test_error_invalid_values(data, all_arithmetic_operators):
214198 # more-correct than np.nan here.
215199 tm .assert_series_equal (res , expected )
216200 else :
217- with pytest . raises (TypeError , match = msg ):
201+ with tm . external_error_raised (TypeError ):
218202 ops (str_ser )
219203
220- msg = "|" .join (
221- [
222- "can only perform ops with numeric values" ,
223- "cannot perform .* with this index type: DatetimeArray" ,
224- "Addition/subtraction of integers and integer-arrays "
225- "with DatetimeArray is no longer supported. *" ,
226- "unsupported operand type" ,
227- r"can only concatenate str \(not \"int\"\) to str" ,
228- "not all arguments converted during string" ,
229- "cannot subtract DatetimeArray from ndarray" ,
230- "has no kernel" ,
231- "not implemented" ,
232- "not supported for dtype" ,
233- ]
234- )
235- with pytest .raises (TypeError , match = msg ):
204+ with tm .external_error_raised (TypeError ):
236205 ops (pd .Series (pd .date_range ("20180101" , periods = len (s ))))
237206
238207
0 commit comments