Skip to content

Commit a16f5b3

Browse files
committed
mark x fail and some tests fixed
1 parent 545f04c commit a16f5b3

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
@@ -440,16 +440,12 @@ def test_hasnans_isnans(self, index_flat):
440440
@pytest.mark.filterwarnings(r"ignore:PeriodDtype\[B\] is deprecated:FutureWarning")
441441
@pytest.mark.parametrize("na_position", [None, "middle"])
442442
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)
448445

449446
with pytest.raises(ValueError, match=f"invalid na_position: {na_position}"):
450447
index_with_missing.sort_values(na_position=na_position)
451448

452-
453449
@pytest.mark.filterwarnings(r"ignore:PeriodDtype\[B\] is deprecated:FutureWarning")
454450
@pytest.mark.parametrize("na_position", ["first", "last"])
455451
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):
458454

459455
non_na_values = [x for x in index_with_missing if pd.notna(x)]
460456
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)
464458

465459
if isinstance(index_with_missing, CategoricalIndex):
466460
request.applymarker(
@@ -482,8 +476,7 @@ def test_sort_values_with_missing(index_with_missing, na_position, request):
482476

483477
result = index_with_missing.sort_values(na_position=na_position)
484478
tm.assert_index_equal(result, expected)
485-
486-
479+
487480
def test_sort_values_natsort_key():
488481
# GH#56081
489482
def split_convert(s):

0 commit comments

Comments
 (0)