From 5bf99680d1cf29150b9102b34d3816dc7660c9a1 Mon Sep 17 00:00:00 2001 From: Patrick Hoefler <61934744+phofl@users.noreply.github.com> Date: Tue, 6 Sep 2022 21:47:31 +0200 Subject: [PATCH 1/2] Backport PR #48398: WARN: Avoid FutureWarnings in tests --- pandas/tests/frame/methods/test_update.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandas/tests/frame/methods/test_update.py b/pandas/tests/frame/methods/test_update.py index a35530100a425..af7a13f6adb5a 100644 --- a/pandas/tests/frame/methods/test_update.py +++ b/pandas/tests/frame/methods/test_update.py @@ -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): + result.update(result) expected = DataFrame([pd.Timestamp("2019", tz="UTC")]) tm.assert_frame_equal(result, expected) From 4b9d630c4bebf7608fd4b9cbe7842622e01abbe3 Mon Sep 17 00:00:00 2001 From: Patrick Hoefler <61934744+phofl@users.noreply.github.com> Date: Thu, 8 Sep 2022 20:57:39 +0200 Subject: [PATCH 2/2] Update --- pandas/tests/frame/methods/test_fillna.py | 2 +- pandas/tests/frame/methods/test_update.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/pandas/tests/frame/methods/test_fillna.py b/pandas/tests/frame/methods/test_fillna.py index 4cf6706707569..3d7e5c6823e9d 100644 --- a/pandas/tests/frame/methods/test_fillna.py +++ b/pandas/tests/frame/methods/test_fillna.py @@ -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 diff --git a/pandas/tests/frame/methods/test_update.py b/pandas/tests/frame/methods/test_update.py index af7a13f6adb5a..a35530100a425 100644 --- a/pandas/tests/frame/methods/test_update.py +++ b/pandas/tests/frame/methods/test_update.py @@ -136,8 +136,7 @@ def test_update_from_non_df(self): def test_update_datetime_tz(self): # GH 25807 result = DataFrame([pd.Timestamp("2019", tz="UTC")]) - with tm.assert_produces_warning(FutureWarning): - result.update(result) + result.update(result) expected = DataFrame([pd.Timestamp("2019", tz="UTC")]) tm.assert_frame_equal(result, expected)