Skip to content

Commit 2a381d3

Browse files
committed
Fixup tests
1 parent d93ac90 commit 2a381d3

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

pandas/tests/apply/test_frame_apply.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -917,13 +917,13 @@ def test_listlike_lambda(ops, by_row, expected):
917917

918918
def test_listlike_datetime_index_unsorted():
919919
# https://github.com/pandas-dev/pandas/pull/62843
920-
values = [datetime(2024, 1, 1), datetime(2024, 1, 2)]
920+
values = [datetime(2024, 1, 1), datetime(2024, 1, 2), datetime(2024, 1, 3)]
921921
df = DataFrame({"a": [1, 2]}, index=[values[1], values[0]])
922-
result = df.apply([lambda x: x], by_row=False)
922+
result = df.apply([lambda x: x, lambda x: x.shift(freq="D")], by_row=False)
923923
expected = DataFrame(
924-
[[1], [2]],
925-
index=[values[1], values[0]],
926-
columns=MultiIndex([["a"], ["<lambda>"]], codes=[[0], [0]]),
924+
[[1.0, 2.0], [2.0, np.nan], [np.nan, 1.0]],
925+
index=[values[1], values[0], values[2]],
926+
columns=MultiIndex([["a"], ["<lambda>"]], codes=[[0, 0], [0, 0]]),
927927
)
928928
tm.assert_frame_equal(result, expected)
929929

pandas/tests/strings/test_cat.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -347,13 +347,13 @@ def test_str_cat_align_mixed_inputs(join_type):
347347
def test_str_cat_datetime_index_unsorted(join_type):
348348
# https://github.com/pandas-dev/pandas/pull/62843
349349
values = [datetime(2024, 1, 1), datetime(2024, 1, 2)]
350-
s = Series(["a", "b"], index=[values[0], values[1]])
351-
others = Series(["c", "d"], index=[values[1], values[0]])
350+
s = Series(["a", "b"], index=[values[1], values[0]])
351+
others = Series(["c", "d"], index=[values[0], values[1]])
352352
result = s.str.cat(others, join=join_type)
353-
if join_type == "right":
354-
expected = Series(["bc", "ad"], index=[values[1], values[0]])
353+
if join_type == "outer" or join_type == "right":
354+
expected = Series(["bc", "ad"], index=[values[0], values[1]])
355355
else:
356-
expected = Series(["ad", "bc"], index=[values[0], values[1]])
356+
expected = Series(["ad", "bc"], index=[values[1], values[0]])
357357
tm.assert_series_equal(result, expected)
358358

359359

0 commit comments

Comments
 (0)