Skip to content

Commit 23adb71

Browse files
GH1214 Fix test
1 parent a860d0f commit 23adb71

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

tests/test_frame.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4350,6 +4350,20 @@ def test_unstack() -> None:
43504350
["b", "b", pd.Timestamp(2024, 3, 2)],
43514351
]
43524352
).set_index([0, 1])
4353+
df_sr = pd.DataFrame(
4354+
[
4355+
["a", "b", "abc"],
4356+
["a", "a", "def"],
4357+
["b", "b", "ghi"],
4358+
]
4359+
).set_index([0, 1])
4360+
df_flt = pd.DataFrame(
4361+
[
4362+
["a", "b", 1],
4363+
["a", "a", 12],
4364+
["b", "b", 14],
4365+
]
4366+
).set_index([0, 1])
43534367

43544368
check(assert_type(df.unstack(0), pd.DataFrame | pd.Series), pd.DataFrame)
43554369
check(
@@ -4359,14 +4373,15 @@ def test_unstack() -> None:
43594373
pd.DataFrame,
43604374
)
43614375
check(
4362-
assert_type(df.unstack(1, fill_value=0.0), pd.DataFrame | pd.Series),
4376+
assert_type(df_flt.unstack(1, fill_value=0.0), pd.DataFrame | pd.Series),
43634377
pd.DataFrame,
43644378
)
43654379
check(
4366-
assert_type(df.unstack(1, fill_value=1), pd.DataFrame | pd.Series), pd.DataFrame
4380+
assert_type(df_flt.unstack(1, fill_value=1), pd.DataFrame | pd.Series),
4381+
pd.DataFrame,
43674382
)
43684383
check(
4369-
assert_type(df.unstack(1, fill_value="string"), pd.DataFrame | pd.Series),
4384+
assert_type(df_sr.unstack(1, fill_value="string"), pd.DataFrame | pd.Series),
43704385
pd.DataFrame,
43714386
)
43724387
check(
@@ -4381,7 +4396,7 @@ def test_unstack() -> None:
43814396
)
43824397
check(
43834398
assert_type(
4384-
df.unstack(1, fill_value=0.0, sort=False), pd.DataFrame | pd.Series
4399+
df_flt.unstack(1, fill_value=0.0, sort=False), pd.DataFrame | pd.Series
43854400
),
43864401
pd.DataFrame,
43874402
)

0 commit comments

Comments
 (0)