Skip to content

WARN: Avoid FutureWarnings in tests #48398

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pandas/tests/frame/methods/test_fillna.py
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,6 @@ def test_fillna_nonconsolidated_frame():
],
columns=["i1", "i2", "i3", "f1"],
)
df_nonconsol = df.pivot("i1", "i2")
df_nonconsol = df.pivot(index="i1", columns="i2")
result = df_nonconsol.fillna(0)
assert result.isna().sum().sum() == 0
3 changes: 2 additions & 1 deletion pandas/tests/frame/methods/test_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ def test_update_from_non_df(self):
def test_update_datetime_tz(self):
# GH 25807
result = DataFrame([pd.Timestamp("2019", tz="UTC")])
result.update(result)
with tm.assert_produces_warning(FutureWarning):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this is wrong. in DataFrame.update we use self.loc[:, col] = ... in a way that produces a warning that we probably don't want. so we need to change what we're doing there, not catch a warning here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

analogous to #48254

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second look @phofl, I agree with @jbrockmendel. Since update isn't deprecated, users shouldn't receive a FutureWarning when calling that method.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, agreed. Forgot to post here. Hadn't had time to take a closer look yet though. We probably have a couple more of those cases

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened #48468 to revert the update warning

result.update(result)
expected = DataFrame([pd.Timestamp("2019", tz="UTC")])
tm.assert_frame_equal(result, expected)

Expand Down