@@ -386,22 +386,30 @@ def test_asi8_deprecation(self, index):
386
386
387
387
388
388
@pytest .mark .parametrize ("na_position" , [None , "middle" ])
389
- def test_sort_values_invalid_na_position (index_with_missing , na_position ):
390
- if isinstance (index_with_missing , (CategoricalIndex , MultiIndex )):
391
- pytest .xfail ("missing value sorting order not defined for index type" )
389
+ def test_sort_values_invalid_na_position (request , index_with_missing , na_position ):
390
+ if isinstance (index_with_missing , MultiIndex ):
391
+ request .node .add_marker (
392
+ pytest .mark .xfail (
393
+ reason = "missing value sorting order not defined for index type"
394
+ )
395
+ )
392
396
393
397
if na_position not in ["first" , "last" ]:
394
398
with pytest .raises (ValueError , match = f"invalid na_position: { na_position } " ):
395
399
index_with_missing .sort_values (na_position = na_position )
396
400
397
401
398
402
@pytest .mark .parametrize ("na_position" , ["first" , "last" ])
399
- def test_sort_values_with_missing (index_with_missing , na_position ):
403
+ def test_sort_values_with_missing (request , index_with_missing , na_position ):
400
404
# GH 35584. Test that sort_values works with missing values,
401
405
# sort non-missing and place missing according to na_position
402
406
403
- if isinstance (index_with_missing , (CategoricalIndex , MultiIndex )):
404
- pytest .xfail ("missing value sorting order not defined for index type" )
407
+ if isinstance (index_with_missing , MultiIndex ):
408
+ request .node .add_marker (
409
+ pytest .mark .xfail (reason = "missing value sorting order not implemented" )
410
+ )
411
+ elif isinstance (index_with_missing , CategoricalIndex ):
412
+ pytest .skip ("missing value sorting order not well-defined" )
405
413
406
414
missing_count = np .sum (index_with_missing .isna ())
407
415
not_na_vals = index_with_missing [index_with_missing .notna ()].values
0 commit comments