Skip to content

Commit 599df6d

Browse files
committed
test_union_base mixed int string test fail fixed
1 parent 1fe92f9 commit 599df6d

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

after.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ FAILED pandas/tests/indexes/test_numpy_compat.py::test_numpy_ufuncs_reductions[m
33
FAILED pandas/tests/indexes/test_numpy_compat.py::test_numpy_ufuncs_reductions[mixed-int-string-minimum] - TypeError: '<=' not supported between instances of 'int' and 'str'
44
DONE FAILED pandas/tests/indexes/test_old_base.py::TestBase::test_argsort[mixed-int-string] - TypeError: '<' not supported between instances of 'str' and 'int'
55
DONE FAILED pandas/tests/indexes/test_old_base.py::TestBase::test_numpy_argsort[mixed-int-string] - TypeError: '<' not supported between instances of 'str' and 'int'
6-
FAILED pandas/tests/indexes/test_setops.py::test_union_same_types[mixed-int-string] - TypeError: '<' not supported between instances of 'str' and 'int'
7-
FAILED pandas/tests/indexes/test_setops.py::test_union_different_types[mixed-int-string] - TypeError: '<' not supported between instances of 'str' and 'int'
6+
DONE FAILED pandas/tests/indexes/test_setops.py::test_union_same_types[mixed-int-string] - TypeError: '<' not supported between instances of 'str' and 'int'
7+
DONE FAILED pandas/tests/indexes/test_setops.py::test_union_different_types[mixed-int-string] - TypeError: '<' not supported between instances of 'str' and 'int'
88
FAILED pandas/tests/indexes/test_setops.py::TestSetOps::test_union_base[mixed-int-string] - TypeError: '<' not supported between instances of 'str' and 'int'
99
FAILED pandas/tests/indexes/test_setops.py::TestSetOps::test_symmetric_difference[mixed-int-string] - TypeError: '<' not supported between instances of 'str' and 'int'
1010
FAILED pandas/tests/indexes/test_setops.py::TestSetOps::test_union_unequal[mixed-int-string-A-A-A] - TypeError: '<' not supported between instances of 'str' and 'int'

pandas/tests/indexes/test_setops.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,17 @@ def test_intersection_base(self, index):
229229
@pytest.mark.filterwarnings(r"ignore:PeriodDtype\[B\] is deprecated:FutureWarning")
230230
def test_union_base(self, index):
231231
index = index.unique()
232+
233+
# Mixed int string
234+
if index.equals(pd.Index([0, "a", 1, "b", 2, "c"])):
235+
index = index.astype(str)
236+
232237
first = index[3:]
233238
second = index[:5]
234239
everything = index
235240

236-
union = first.union(second)
241+
# Default sort=None
242+
union = first.union(second, sort=None)
237243
tm.assert_index_equal(union.sort_values(), everything.sort_values())
238244

239245
if isinstance(index.dtype, DatetimeTZDtype):
@@ -244,7 +250,7 @@ def test_union_base(self, index):
244250
# GH#10149
245251
cases = [second.to_numpy(), second.to_series(), second.to_list()]
246252
for case in cases:
247-
result = first.union(case)
253+
result = first.union(case, sort=None)
248254
assert equal_contents(result, everything)
249255

250256
if isinstance(index, MultiIndex):

0 commit comments

Comments
 (0)