@@ -439,9 +439,11 @@ 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" ]:
444
+ request .applymarker (
445
+ pytest .mark .xfail (reason = "Test not supported for mixed int/string types" )
446
+ )
445
447
446
448
with pytest .raises (ValueError , match = f"invalid na_position: { na_position } " ):
447
449
index_with_missing .sort_values (na_position = na_position )
@@ -453,9 +455,10 @@ def test_sort_values_with_missing(index_with_missing, na_position, request):
453
455
# GH 35584. Test that sort_values works with missing values,
454
456
# sort non-missing and place missing according to na_position
455
457
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 )
458
+ if getattr (index_with_missing , "inferred_type" , None ) in ["mixed" , "mixed-integer" ]:
459
+ request .applymarker (
460
+ pytest .mark .xfail (reason = "Test not supported for mixed int/string types" )
461
+ )
459
462
460
463
if isinstance (index_with_missing , CategoricalIndex ):
461
464
request .applymarker (
0 commit comments