Skip to content

Commit 1466428

Browse files
committed
some comments fixed
1 parent e596946 commit 1466428

File tree

4 files changed

+20
-38
lines changed

4 files changed

+20
-38
lines changed

pandas/tests/base/test_misc.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,18 +149,18 @@ def test_searchsorted(request, index_or_series_obj):
149149

150150
if isinstance(obj, pd.MultiIndex):
151151
request.applymarker(pytest.mark.xfail(reason="GH 14833", strict=False))
152-
return
153152

154153
if isinstance(obj, Index):
155154
if obj.inferred_type in ["mixed", "mixed-integer"]:
156155
try:
157156
obj = obj.astype(str)
158157
except (TypeError, ValueError):
159158
request.applymarker(pytest.mark.xfail(reason="Mixed types"))
160-
return
161159

162160
elif obj.dtype.kind == "c":
163-
return
161+
request.applymarker(
162+
pytest.mark.xfail(reason="complex objects are not comparable")
163+
)
164164

165165
max_obj = max(obj, default=0)
166166
index = np.searchsorted(obj, max_obj)

pandas/tests/indexes/multi/test_setops.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -626,9 +626,10 @@ def test_union_with_duplicates_keep_ea_dtype(dupe_val, any_numeric_ea_dtype):
626626

627627
@pytest.mark.filterwarnings(r"ignore:PeriodDtype\[B\] is deprecated:FutureWarning")
628628
def test_union_duplicates(index, request):
629-
# special case for mixed types
630-
if index.inferred_type == "mixed":
631-
index = index.map(str)
629+
if isinstance(index, MultiIndex) and isinstance(index[0], tuple):
630+
request.applymarker(
631+
pytest.mark.xfail(reason="GH#xxxxx - tuple handling in union")
632+
)
632633

633634
# GH#38977
634635
if index.empty or isinstance(index, (IntervalIndex, CategoricalIndex)):

pandas/tests/indexes/test_common.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -439,10 +439,13 @@ 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)
445-
442+
def test_sort_values_invalid_na_position(index_with_missing, na_position, request):
443+
if index_with_missing.inferred_type == "mixed-integer":
444+
request.applymarker(
445+
pytest.mark.xfail(
446+
reason="Mixed-integer Indexes do not support sorting with missing values"
447+
)
448+
)
446449
with pytest.raises(ValueError, match=f"invalid na_position: {na_position}"):
447450
index_with_missing.sort_values(na_position=na_position)
448451

@@ -453,10 +456,12 @@ def test_sort_values_with_missing(index_with_missing, na_position, request):
453456
# GH 35584. Test that sort_values works with missing values,
454457
# sort non-missing and place missing according to na_position
455458

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)
459-
459+
if index_with_missing.inferred_type == "mixed-integer":
460+
request.applymarker(
461+
pytest.mark.xfail(
462+
reason="Mixed-integer Indexes do not support sorting with missing values"
463+
)
464+
)
460465
if isinstance(index_with_missing, CategoricalIndex):
461466
request.applymarker(
462467
pytest.mark.xfail(

pandas/tests/indexes/test_mixed_int_string.py

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)