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