Skip to content
19 changes: 16 additions & 3 deletions tests/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -3996,8 +3996,9 @@ def test_hashable_args() -> None:
df.columns = ["test"] # type: ignore[assignment]

testDict = {"test": 1}
df.to_string("test", col_space=testDict)
df.to_string("test", col_space={"test": 1})
with ensure_clean() as path:
df.to_string(path, col_space=testDict)
df.to_string(path, col_space={"test": 1})


# GH 906
Expand All @@ -4009,7 +4010,19 @@ def test_transpose() -> None:
df = pd.DataFrame({"a": [1, 1, 2], "b": [4, 5, 6]})
check(assert_type(df.transpose(), pd.DataFrame), pd.DataFrame)
check(assert_type(df.transpose(None), pd.DataFrame), pd.DataFrame)
check(assert_type(df.transpose(copy=True), pd.DataFrame), pd.DataFrame)

msg = (
r"The copy keyword is deprecated and will be removed in a future version\. Copy"
r"-on-Write is active in pandas since 3\.0 which utilizes a lazy copy mechanism"
r" that defers copies until necessary\. Use \.copy\(\) to make an eager copy if"
" necessary.*"
)
with pytest_warns_bounded(
DeprecationWarning,
msg,
lower="2.2.99",
):
check(assert_type(df.transpose(copy=True), pd.DataFrame), pd.DataFrame)


def test_combine() -> None:
Expand Down
15 changes: 14 additions & 1 deletion tests/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -3714,6 +3714,19 @@ def test_align() -> None:
aligned_s0, aligned_s1 = s0.align(s1)
check(assert_type(aligned_s0, pd.Series), pd.Series)
check(assert_type(aligned_s1, pd.Series), pd.Series)
aligned_s0, aligned_s1 = s0.align(s1, fill_value=0, axis=0, level=0, copy=False)

msg = (
r"The copy keyword is deprecated and will be removed in a future version\. Copy"
r"-on-Write is active in pandas since 3\.0 which utilizes a lazy copy mechanism"
r" that defers copies until necessary\. Use \.copy\(\) to make an eager copy if"
" necessary.*"
)
with pytest_warns_bounded(
DeprecationWarning,
msg,
lower="2.2.99",
):
aligned_s0, aligned_s1 = s0.align(s1, fill_value=0, axis=0, level=0, copy=False)

check(assert_type(aligned_s0, pd.Series), pd.Series)
check(assert_type(aligned_s1, pd.Series), pd.Series)