Skip to content

Commit 108e41c

Browse files
GH1089Fix nightly for pandas 3.0.0 due to future warnings (#1122)
* GHXXX Fix nightly for pandas 3.0.0 due to future warnings * Fix tests
1 parent d14fb18 commit 108e41c

File tree

2 files changed

+28
-14
lines changed

2 files changed

+28
-14
lines changed

tests/test_frame.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2670,12 +2670,20 @@ def test_frame_reindex_like() -> None:
26702670
# GH 84
26712671
df = pd.DataFrame({"a": [1, 2, 3]}, index=[0, 1, 2])
26722672
other = pd.DataFrame({"a": [1, 2]}, index=[1, 0])
2673-
check(
2674-
assert_type(
2675-
df.reindex_like(other, method="nearest", tolerance=[0.5, 0.2]), pd.DataFrame
2676-
),
2677-
pd.DataFrame,
2678-
)
2673+
2674+
with pytest_warns_bounded(
2675+
FutureWarning,
2676+
"the 'method' keyword is deprecated and will be removed in a future version. Please take steps to stop the use of 'method'",
2677+
lower="2.2.99",
2678+
upper="3.0.99",
2679+
):
2680+
check(
2681+
assert_type(
2682+
df.reindex_like(other, method="nearest", tolerance=[0.5, 0.2]),
2683+
pd.DataFrame,
2684+
),
2685+
pd.DataFrame,
2686+
)
26792687

26802688

26812689
def test_frame_ndarray_assignmment() -> None:

tests/test_series.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3574,14 +3574,20 @@ def test_series_reindex() -> None:
35743574
def test_series_reindex_like() -> None:
35753575
s = pd.Series([1, 2, 3], index=[0, 1, 2])
35763576
other = pd.Series([1, 2], index=[1, 0])
3577-
check(
3578-
assert_type(
3579-
s.reindex_like(other, method="nearest", tolerance=[0.5, 0.2]),
3580-
"pd.Series[int]",
3581-
),
3582-
pd.Series,
3583-
np.integer,
3584-
)
3577+
with pytest_warns_bounded(
3578+
FutureWarning,
3579+
"the 'method' keyword is deprecated and will be removed in a future version. Please take steps to stop the use of 'method'",
3580+
lower="2.2.99",
3581+
upper="3.0.99",
3582+
):
3583+
check(
3584+
assert_type(
3585+
s.reindex_like(other, method="nearest", tolerance=[0.5, 0.2]),
3586+
"pd.Series[int]",
3587+
),
3588+
pd.Series,
3589+
np.integer,
3590+
)
35853591

35863592

35873593
def test_info() -> None:

0 commit comments

Comments
 (0)