@@ -439,23 +439,21 @@ def test_hasnans_isnans(self, index_flat):
439
439
440
440
@pytest .mark .filterwarnings (r"ignore:PeriodDtype\[B\] is deprecated:FutureWarning" )
441
441
@pytest .mark .parametrize ("na_position" , [None , "middle" ])
442
- def test_sort_values_invalid_na_position (index_with_missing , na_position ):
443
- if len ({ type ( x ) for x in index_with_missing if pd . notna ( x )}) > 1 :
444
- index_with_missing = index_with_missing . map ( str )
442
+ def test_sort_values_invalid_na_position (index_with_missing , na_position , request ):
443
+ if getattr ( index_with_missing , "inferred_type" , None ) in { "mixed" , "mixed-integer" , "mixed-int-string" } :
444
+ request . applymarker ( pytest . mark . xfail ( reason = "Test not supported for mixed type index" ) )
445
445
446
446
with pytest .raises (ValueError , match = f"invalid na_position: { na_position } " ):
447
447
index_with_missing .sort_values (na_position = na_position )
448
448
449
-
450
449
@pytest .mark .filterwarnings (r"ignore:PeriodDtype\[B\] is deprecated:FutureWarning" )
451
450
@pytest .mark .parametrize ("na_position" , ["first" , "last" ])
452
451
def test_sort_values_with_missing (index_with_missing , na_position , request ):
453
452
# GH 35584. Test that sort_values works with missing values,
454
453
# sort non-missing and place missing according to na_position
455
454
456
- non_na_values = [x for x in index_with_missing if pd .notna (x )]
457
- if len ({type (x ) for x in non_na_values }) > 1 :
458
- index_with_missing = index_with_missing .map (str )
455
+ if getattr (index_with_missing , "inferred_type" , None ) in {"mixed" , "mixed-integer" , "mixed-int-string" }:
456
+ request .applymarker (pytest .mark .xfail (reason = "Test not supported for mixed type index" ))
459
457
460
458
if isinstance (index_with_missing , CategoricalIndex ):
461
459
request .applymarker (
0 commit comments