Skip to content

Commit 3ff7fc0

Browse files
committed
test common with new fails
1 parent 0e8b3e5 commit 3ff7fc0

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

pandas/tests/indexes/test_common.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -439,9 +439,11 @@ def test_hasnans_isnans(self, index_flat):
439439

440440
@pytest.mark.filterwarnings(r"ignore:PeriodDtype\[B\] is deprecated:FutureWarning")
441441
@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+
)
445447

446448
with pytest.raises(ValueError, match=f"invalid na_position: {na_position}"):
447449
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):
453455
# GH 35584. Test that sort_values works with missing values,
454456
# sort non-missing and place missing according to na_position
455457

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+
)
459462

460463
if isinstance(index_with_missing, CategoricalIndex):
461464
request.applymarker(

0 commit comments

Comments
 (0)