Skip to content

Commit 01e43d8

Browse files
GH1246 PR feedback
1 parent 4815873 commit 01e43d8

File tree

2 files changed

+38
-24
lines changed

2 files changed

+38
-24
lines changed

tests/test_frame.py

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1541,6 +1541,21 @@ def test_types_groupby() -> None:
15411541
assert_type(df.groupby(by=["col1", "col2"]).nunique(), pd.DataFrame),
15421542
pd.DataFrame,
15431543
)
1544+
with pytest_warns_bounded(
1545+
FutureWarning,
1546+
"(The provided callable <built-in function sum> is currently using|The behavior of DataFrame.sum with)",
1547+
upper="2.3.99",
1548+
):
1549+
with pytest_warns_bounded(
1550+
FutureWarning,
1551+
"DataFrameGroupBy.apply operated on the grouping columns",
1552+
upper="2.3.99",
1553+
):
1554+
if PD_LTE_23:
1555+
check(
1556+
assert_type(df.groupby(by="col1").apply(sum), pd.DataFrame),
1557+
pd.DataFrame,
1558+
)
15441559
check(assert_type(df.groupby("col1").transform("sum"), pd.DataFrame), pd.DataFrame)
15451560
s1 = df.set_index("col1")["col2"]
15461561
check(assert_type(s1, pd.Series), pd.Series)
@@ -3435,7 +3450,7 @@ def sum_mean(x: pd.DataFrame) -> float:
34353450
FutureWarning,
34363451
"DataFrameGroupBy.apply operated on the grouping columns.",
34373452
lower="2.2.99",
3438-
upper="2.3.99",
3453+
upper="2.99",
34393454
):
34403455
check(
34413456
assert_type(df.groupby("col1").apply(sum_mean), pd.Series),
@@ -3447,7 +3462,7 @@ def sum_mean(x: pd.DataFrame) -> float:
34473462
FutureWarning,
34483463
"DataFrameGroupBy.apply operated on the grouping columns.",
34493464
lower="2.2.99",
3450-
upper="2.99.99",
3465+
upper="2.99",
34513466
):
34523467
check(assert_type(df.groupby("col1").apply(lfunc), pd.Series), pd.Series)
34533468

@@ -3458,7 +3473,7 @@ def sum_to_list(x: pd.DataFrame) -> list:
34583473
FutureWarning,
34593474
"DataFrameGroupBy.apply operated on the grouping columns.",
34603475
lower="2.2.99",
3461-
upper="2.3.99",
3476+
upper="2.99",
34623477
):
34633478
check(assert_type(df.groupby("col1").apply(sum_to_list), pd.Series), pd.Series)
34643479

@@ -3469,7 +3484,7 @@ def sum_to_series(x: pd.DataFrame) -> pd.Series:
34693484
FutureWarning,
34703485
"DataFrameGroupBy.apply operated on the grouping columns.",
34713486
lower="2.2.99",
3472-
upper="2.3.99",
3487+
upper="2.99",
34733488
):
34743489
check(
34753490
assert_type(df.groupby("col1").apply(sum_to_series), pd.DataFrame),
@@ -3483,7 +3498,7 @@ def sample_to_df(x: pd.DataFrame) -> pd.DataFrame:
34833498
FutureWarning,
34843499
"DataFrameGroupBy.apply operated on the grouping columns.",
34853500
lower="2.2.99",
3486-
upper="2.3.99",
3501+
upper="2.99",
34873502
):
34883503
check(
34893504
assert_type(
@@ -3757,7 +3772,7 @@ def test_resample_150_changes() -> None:
37573772
FutureWarning,
37583773
"'M' is deprecated",
37593774
lower="2.1.99",
3760-
upper="2.3.99",
3775+
upper="2.99",
37613776
upper_exception=ValueError,
37623777
):
37633778
frame.resample("M", group_keys=True)
@@ -4377,7 +4392,6 @@ def test_transpose() -> None:
43774392
DeprecationWarning,
43784393
msg,
43794394
lower="2.3.99",
4380-
upper="3.0.0",
43814395
):
43824396
check(assert_type(df.transpose(copy=True), pd.DataFrame), pd.DataFrame)
43834397

tests/test_groupby.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def test_frame_groupby_resample() -> None:
8181
FutureWarning,
8282
"DataFrameGroupBy.(apply|resample) operated on the grouping columns",
8383
lower="2.2.99",
84-
upper="2.3.99",
84+
upper="2.99",
8585
):
8686
check(assert_type(GB_DF.resample("ME").sum(), DataFrame), DataFrame)
8787
check(assert_type(GB_DF.resample("ME").prod(), DataFrame), DataFrame)
@@ -129,12 +129,12 @@ def test_frame_groupby_resample() -> None:
129129
FutureWarning,
130130
"DataFrameGroupBy.(apply|resample) operated on the grouping columns",
131131
lower="2.2.99",
132-
upper="2.3.99",
132+
upper="2.99",
133133
):
134134
with pytest_warns_bounded(
135135
FutureWarning,
136136
r"The provided callable <function (sum|mean) .*> is currently using ",
137-
upper="2.3.99",
137+
upper="2.99",
138138
):
139139
check(
140140
assert_type(GB_DF.resample("ME").aggregate(np.sum), DataFrame),
@@ -178,7 +178,7 @@ def f(val: DataFrame) -> Series:
178178
FutureWarning,
179179
"DataFrameGroupBy.(apply|resample) operated on the grouping columns",
180180
lower="2.2.99",
181-
upper="2.3.99",
181+
upper="2.99",
182182
):
183183
check(assert_type(GB_DF.resample("ME").aggregate(f), DataFrame), DataFrame)
184184

@@ -196,12 +196,12 @@ def df2scalar(val: DataFrame) -> float:
196196
FutureWarning,
197197
"DataFrameGroupBy.(apply|resample) operated on the grouping columns",
198198
lower="2.2.99",
199-
upper="2.3.99",
199+
upper="2.99",
200200
):
201201
with pytest_warns_bounded(
202202
FutureWarning,
203203
r"The provided callable <function (sum|mean) .*> is currently using ",
204-
upper="2.3.99",
204+
upper="2.99",
205205
):
206206
check(GB_DF.resample("ME").aggregate(np.sum), DataFrame)
207207
check(GB_DF.resample("ME").aggregate([np.mean]), DataFrame)
@@ -381,7 +381,7 @@ def test_series_groupby_resample() -> None:
381381
with pytest_warns_bounded(
382382
FutureWarning,
383383
r"The provided callable <function (sum|mean) .*> is currently using ",
384-
upper="2.3.99",
384+
upper="2.99",
385385
):
386386
check(
387387
assert_type(
@@ -479,7 +479,7 @@ def s2scalar(val: Series) -> float:
479479
with pytest_warns_bounded(
480480
FutureWarning,
481481
r"The provided callable <function (sum|mean) .*> is currently using ",
482-
upper="2.3.99",
482+
upper="2.99",
483483
):
484484
check(GB_S.resample("ME").aggregate(np.sum), Series)
485485
check(GB_S.resample("ME").aggregate([np.mean]), DataFrame)
@@ -526,7 +526,7 @@ def test_frame_groupby_rolling() -> None:
526526
with pytest_warns_bounded(
527527
FutureWarning,
528528
r"The provided callable <function (sum|mean) .*> is currently using ",
529-
upper="2.3.99",
529+
upper="2.99",
530530
):
531531
check(assert_type(GB_DF.rolling(1).aggregate(np.sum), DataFrame), DataFrame)
532532
check(assert_type(GB_DF.rolling(1).agg(np.sum), DataFrame), DataFrame)
@@ -570,7 +570,7 @@ def df2scalar(val: DataFrame) -> float:
570570
with pytest_warns_bounded(
571571
FutureWarning,
572572
r"The provided callable <function (sum|mean) .*> is currently using ",
573-
upper="2.3.99",
573+
upper="2.99",
574574
):
575575
check(GB_DF.rolling(1).aggregate(np.sum), DataFrame)
576576
check(GB_DF.rolling(1).aggregate([np.mean]), DataFrame)
@@ -648,7 +648,7 @@ def test_series_groupby_rolling() -> None:
648648
with pytest_warns_bounded(
649649
FutureWarning,
650650
r"The provided callable <function (sum|mean) .*> is currently using ",
651-
upper="2.3.99",
651+
upper="2.99",
652652
):
653653
check(assert_type(GB_S.rolling(1).aggregate("sum"), Series), Series)
654654
check(assert_type(GB_S.rolling(1).aggregate(np.sum), Series), Series)
@@ -721,7 +721,7 @@ def test_frame_groupby_expanding() -> None:
721721
with pytest_warns_bounded(
722722
FutureWarning,
723723
r"The provided callable <function (sum|mean) .*> is currently using ",
724-
upper="2.3.99",
724+
upper="2.99",
725725
):
726726
check(assert_type(GB_DF.expanding(1).aggregate(np.sum), DataFrame), DataFrame)
727727
check(assert_type(GB_DF.expanding(1).agg(np.sum), DataFrame), DataFrame)
@@ -767,7 +767,7 @@ def df2scalar(val: DataFrame) -> float:
767767
with pytest_warns_bounded(
768768
FutureWarning,
769769
r"The provided callable <function (sum|mean) .*> is currently using ",
770-
upper="2.3.99",
770+
upper="2.99",
771771
):
772772
check(GB_DF.expanding(1).aggregate(np.sum), DataFrame)
773773
check(GB_DF.expanding(1).aggregate([np.mean]), DataFrame)
@@ -847,7 +847,7 @@ def test_series_groupby_expanding() -> None:
847847
with pytest_warns_bounded(
848848
FutureWarning,
849849
r"The provided callable <function (sum|mean) .*> is currently using ",
850-
upper="2.3.99",
850+
upper="2.99",
851851
):
852852
check(assert_type(GB_S.expanding(1).aggregate("sum"), Series), Series)
853853
check(assert_type(GB_S.expanding(1).aggregate(np.sum), Series), Series)
@@ -916,7 +916,7 @@ def test_frame_groupby_ewm() -> None:
916916
with pytest_warns_bounded(
917917
FutureWarning,
918918
r"The provided callable <function (sum|mean) .*> is currently using ",
919-
upper="2.3.99",
919+
upper="2.99",
920920
):
921921
check(assert_type(GB_DF.ewm(1).aggregate(np.sum), DataFrame), DataFrame)
922922
check(assert_type(GB_DF.ewm(1).agg(np.sum), DataFrame), DataFrame)
@@ -947,7 +947,7 @@ def test_frame_groupby_ewm() -> None:
947947
with pytest_warns_bounded(
948948
FutureWarning,
949949
r"The provided callable <function (sum|mean) .*> is currently using ",
950-
upper="2.3.99",
950+
upper="2.99",
951951
):
952952
check(GB_DF.ewm(1).aggregate(np.sum), DataFrame)
953953
check(GB_DF.ewm(1).aggregate([np.mean]), DataFrame)
@@ -1020,7 +1020,7 @@ def test_series_groupby_ewm() -> None:
10201020
with pytest_warns_bounded(
10211021
FutureWarning,
10221022
r"The provided callable <function (sum|mean) .*> is currently using ",
1023-
upper="2.3.99",
1023+
upper="2.99",
10241024
):
10251025
check(assert_type(GB_S.ewm(1).aggregate("sum"), Series), Series)
10261026
if PD_LTE_23:

0 commit comments

Comments
 (0)