@@ -439,10 +439,13 @@ def test_hasnans_isnans(self, index_flat):
439439
440440@pytest .mark .filterwarnings (r"ignore:PeriodDtype\[B\] is deprecated:FutureWarning" )
441441@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 )
445-
442+ def test_sort_values_invalid_na_position (index_with_missing , na_position , request ):
443+ if index_with_missing .inferred_type == "mixed-integer" :
444+ request .applymarker (
445+ pytest .mark .xfail (
446+ reason = "Mixed-integer Indexes do not support sorting with missing values"
447+ )
448+ )
446449 with pytest .raises (ValueError , match = f"invalid na_position: { na_position } " ):
447450 index_with_missing .sort_values (na_position = na_position )
448451
@@ -453,10 +456,12 @@ def test_sort_values_with_missing(index_with_missing, na_position, request):
453456 # GH 35584. Test that sort_values works with missing values,
454457 # sort non-missing and place missing according to na_position
455458
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 )
459-
459+ if index_with_missing .inferred_type == "mixed-integer" :
460+ request .applymarker (
461+ pytest .mark .xfail (
462+ reason = "Mixed-integer Indexes do not support sorting with missing values"
463+ )
464+ )
460465 if isinstance (index_with_missing , CategoricalIndex ):
461466 request .applymarker (
462467 pytest .mark .xfail (
0 commit comments