@@ -440,16 +440,12 @@ def test_hasnans_isnans(self, index_flat):
440
440
@pytest .mark .filterwarnings (r"ignore:PeriodDtype\[B\] is deprecated:FutureWarning" )
441
441
@pytest .mark .parametrize ("na_position" , [None , "middle" ])
442
442
def test_sort_values_invalid_na_position (index_with_missing , na_position ):
443
- non_na_values = [x for x in index_with_missing if pd .notna (x )]
444
- if len ({type (x ) for x in non_na_values }) > 1 :
445
- pytest .mark .xfail (
446
- reason = "Sorting fails due to heterogeneous types in index (int vs str)"
447
- )
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 )
448
445
449
446
with pytest .raises (ValueError , match = f"invalid na_position: { na_position } " ):
450
447
index_with_missing .sort_values (na_position = na_position )
451
448
452
-
453
449
@pytest .mark .filterwarnings (r"ignore:PeriodDtype\[B\] is deprecated:FutureWarning" )
454
450
@pytest .mark .parametrize ("na_position" , ["first" , "last" ])
455
451
def test_sort_values_with_missing (index_with_missing , na_position , request ):
@@ -458,9 +454,7 @@ def test_sort_values_with_missing(index_with_missing, na_position, request):
458
454
459
455
non_na_values = [x for x in index_with_missing if pd .notna (x )]
460
456
if len ({type (x ) for x in non_na_values }) > 1 :
461
- pytest .mark .xfail (
462
- reason = "Sorting fails due to heterogeneous types in index (int vs str)"
463
- )
457
+ index_with_missing = index_with_missing .map (str )
464
458
465
459
if isinstance (index_with_missing , CategoricalIndex ):
466
460
request .applymarker (
@@ -482,8 +476,7 @@ def test_sort_values_with_missing(index_with_missing, na_position, request):
482
476
483
477
result = index_with_missing .sort_values (na_position = na_position )
484
478
tm .assert_index_equal (result , expected )
485
-
486
-
479
+
487
480
def test_sort_values_natsort_key ():
488
481
# GH#56081
489
482
def split_convert (s ):
0 commit comments