Skip to content

Commit eef01db

Browse files
committed
mark x fail and some tests fixed
1 parent 0a46950 commit eef01db

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

pandas/tests/indexes/test_common.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -443,16 +443,12 @@ def test_hasnans_isnans(self, index_flat):
443443
reason="Sorting fails due to heterogeneous types in index (int vs str)"
444444
)
445445
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)
451448

452449
with pytest.raises(ValueError, match=f"invalid na_position: {na_position}"):
453450
index_with_missing.sort_values(na_position=na_position)
454451

455-
456452
@pytest.mark.filterwarnings(r"ignore:PeriodDtype\[B\] is deprecated:FutureWarning")
457453
@pytest.mark.parametrize("na_position", ["first", "last"])
458454
@pytest.mark.xfail(
@@ -464,9 +460,7 @@ def test_sort_values_with_missing(index_with_missing, na_position, request):
464460

465461
non_na_values = [x for x in index_with_missing if pd.notna(x)]
466462
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)
470464

471465
if isinstance(index_with_missing, CategoricalIndex):
472466
request.applymarker(
@@ -488,8 +482,7 @@ def test_sort_values_with_missing(index_with_missing, na_position, request):
488482

489483
result = index_with_missing.sort_values(na_position=na_position)
490484
tm.assert_index_equal(result, expected)
491-
492-
485+
493486
def test_sort_values_natsort_key():
494487
# GH#56081
495488
def split_convert(s):

0 commit comments

Comments
 (0)