@@ -115,10 +115,10 @@ def test_astype_roundtrip(dtype, request):
115
115
def test_add (dtype , request ):
116
116
if dtype == "arrow_string" :
117
117
reason = (
118
- "TypeError: unsupported operand type(s) for +: 'ArrowStringArray' and "
118
+ "unsupported operand type(s) for +: 'ArrowStringArray' and "
119
119
"'ArrowStringArray'"
120
120
)
121
- mark = pytest .mark .xfail (reason = reason )
121
+ mark = pytest .mark .xfail (raises = TypeError , reason = reason )
122
122
request .node .add_marker (mark )
123
123
124
124
a = pd .Series (["a" , "b" , "c" , None , None ], dtype = dtype )
@@ -143,7 +143,7 @@ def test_add(dtype, request):
143
143
def test_add_2d (dtype , request ):
144
144
if dtype == "arrow_string" :
145
145
reason = "Failed: DID NOT RAISE <class 'ValueError'>"
146
- mark = pytest .mark .xfail (reason = reason )
146
+ mark = pytest .mark .xfail (raises = None , reason = reason )
147
147
request .node .add_marker (mark )
148
148
149
149
a = pd .array (["a" , "b" , "c" ], dtype = dtype )
@@ -158,11 +158,8 @@ def test_add_2d(dtype, request):
158
158
159
159
def test_add_sequence (dtype , request ):
160
160
if dtype == "arrow_string" :
161
- reason = (
162
- "TypeError: unsupported operand type(s) for +: 'ArrowStringArray' "
163
- "and 'list'"
164
- )
165
- mark = pytest .mark .xfail (reason = reason )
161
+ reason = "unsupported operand type(s) for +: 'ArrowStringArray' and 'list'"
162
+ mark = pytest .mark .xfail (raises = TypeError , reason = reason )
166
163
request .node .add_marker (mark )
167
164
168
165
a = pd .array (["a" , "b" , None , None ], dtype = dtype )
@@ -179,10 +176,8 @@ def test_add_sequence(dtype, request):
179
176
180
177
def test_mul (dtype , request ):
181
178
if dtype == "arrow_string" :
182
- reason = (
183
- "TypeError: unsupported operand type(s) for *: 'ArrowStringArray' and 'int'"
184
- )
185
- mark = pytest .mark .xfail (reason = reason )
179
+ reason = "unsupported operand type(s) for *: 'ArrowStringArray' and 'int'"
180
+ mark = pytest .mark .xfail (raises = TypeError , reason = reason )
186
181
request .node .add_marker (mark )
187
182
188
183
a = pd .array (["a" , "b" , None ], dtype = dtype )
@@ -246,7 +241,7 @@ def test_comparison_methods_scalar_pd_na(all_compare_operators, dtype):
246
241
def test_comparison_methods_scalar_not_string (all_compare_operators , dtype , request ):
247
242
if all_compare_operators not in ["__eq__" , "__ne__" ]:
248
243
reason = "comparison op not supported between instances of 'str' and 'int'"
249
- mark = pytest .mark .xfail (reason = reason )
244
+ mark = pytest .mark .xfail (raises = TypeError , reason = reason )
250
245
request .node .add_marker (mark )
251
246
252
247
op_name = all_compare_operators
@@ -262,11 +257,9 @@ def test_comparison_methods_scalar_not_string(all_compare_operators, dtype, requ
262
257
263
258
def test_comparison_methods_array (all_compare_operators , dtype , request ):
264
259
if dtype == "arrow_string" :
265
- if all_compare_operators in ["__eq__" , "__ne__" ]:
266
- reason = "NotImplementedError: Neither scalar nor ArrowStringArray"
267
- else :
268
- reason = "AssertionError: left is not an ExtensionArray"
269
- mark = pytest .mark .xfail (reason = reason )
260
+ mark = pytest .mark .xfail (
261
+ raises = AssertionError , reason = "left is not an ExtensionArray"
262
+ )
270
263
request .node .add_marker (mark )
271
264
272
265
op_name = all_compare_operators
@@ -309,8 +302,9 @@ def test_constructor_raises(cls):
309
302
@pytest .mark .parametrize ("copy" , [True , False ])
310
303
def test_from_sequence_no_mutate (copy , cls , request ):
311
304
if cls is ArrowStringArray and copy is False :
312
- reason = "AssertionError: numpy array are different"
313
- mark = pytest .mark .xfail (reason = reason )
305
+ mark = pytest .mark .xfail (
306
+ raises = AssertionError , reason = "numpy array are different"
307
+ )
314
308
request .node .add_marker (mark )
315
309
316
310
nan_arr = np .array (["a" , np .nan ], dtype = object )
@@ -333,8 +327,8 @@ def test_from_sequence_no_mutate(copy, cls, request):
333
327
334
328
def test_astype_int (dtype , request ):
335
329
if dtype == "arrow_string" :
336
- reason = "TypeError: Cannot interpret 'Int64Dtype()' as a data type"
337
- mark = pytest .mark .xfail (reason = reason )
330
+ reason = "Cannot interpret 'Int64Dtype()' as a data type"
331
+ mark = pytest .mark .xfail (raises = TypeError , reason = reason )
338
332
request .node .add_marker (mark )
339
333
340
334
arr = pd .array (["1" , pd .NA , "3" ], dtype = dtype )
@@ -349,12 +343,10 @@ def test_astype_float(dtype, any_float_allowed_nullable_dtype, request):
349
343
350
344
if dtype == "arrow_string" :
351
345
if any_float_allowed_nullable_dtype in {"Float32" , "Float64" }:
352
- reason = "TypeError: Cannot interpret 'Float32Dtype()' as a data type"
346
+ reason = "Cannot interpret 'Float32Dtype()' as a data type"
353
347
else :
354
- reason = (
355
- "TypeError: float() argument must be a string or a number, not 'NAType'"
356
- )
357
- mark = pytest .mark .xfail (reason = reason )
348
+ reason = "float() argument must be a string or a number, not 'NAType'"
349
+ mark = pytest .mark .xfail (raises = TypeError , reason = reason )
358
350
request .node .add_marker (mark )
359
351
360
352
ser = pd .Series (["1.1" , pd .NA , "3.3" ], dtype = dtype )
@@ -376,8 +368,8 @@ def test_reduce(skipna, dtype):
376
368
@pytest .mark .parametrize ("skipna" , [True , False ])
377
369
def test_min_max (method , skipna , dtype , request ):
378
370
if dtype == "arrow_string" :
379
- reason = "AttributeError: 'ArrowStringArray' object has no attribute 'max'"
380
- mark = pytest .mark .xfail (reason = reason )
371
+ reason = "'ArrowStringArray' object has no attribute 'max'"
372
+ mark = pytest .mark .xfail (raises = AttributeError , reason = reason )
381
373
request .node .add_marker (mark )
382
374
383
375
arr = pd .Series (["a" , "b" , "c" , None ], dtype = dtype )
@@ -394,13 +386,12 @@ def test_min_max(method, skipna, dtype, request):
394
386
def test_min_max_numpy (method , box , dtype , request ):
395
387
if dtype == "arrow_string" :
396
388
if box is pd .array :
397
- reason = (
398
- "TypeError: '<=' not supported between instances of 'str' and "
399
- "'NoneType'"
400
- )
389
+ raises = TypeError
390
+ reason = "'<=' not supported between instances of 'str' and 'NoneType'"
401
391
else :
402
- reason = "AttributeError: 'ArrowStringArray' object has no attribute 'max'"
403
- mark = pytest .mark .xfail (reason = reason )
392
+ raises = AttributeError
393
+ reason = "'ArrowStringArray' object has no attribute 'max'"
394
+ mark = pytest .mark .xfail (raises = raises , reason = reason )
404
395
request .node .add_marker (mark )
405
396
406
397
arr = box (["a" , "b" , "c" , None ], dtype = dtype )
@@ -425,10 +416,10 @@ def test_fillna_args(dtype, request):
425
416
426
417
if dtype == "arrow_string" :
427
418
reason = (
428
- "AssertionError: Regex pattern \" Cannot set non-string value '1' into "
419
+ "Regex pattern \" Cannot set non-string value '1' into "
429
420
"a StringArray.\" does not match 'Scalar must be NA or str'"
430
421
)
431
- mark = pytest .mark .xfail (reason = reason )
422
+ mark = pytest .mark .xfail (raises = AssertionError , reason = reason )
432
423
request .node .add_marker (mark )
433
424
434
425
arr = pd .array (["a" , pd .NA ], dtype = dtype )
0 commit comments