@@ -29,7 +29,7 @@ def test_pct_change_with_nas(
29
29
obj = frame_or_series (vals )
30
30
31
31
msg = (
32
- "The 'fill_method' and 'limit' keywords in "
32
+ "The 'fill_method' keyword being not None and the 'limit' keyword in "
33
33
f"{ type (obj ).__name__ } .pct_change are deprecated"
34
34
)
35
35
with tm .assert_produces_warning (FutureWarning , match = msg ):
@@ -46,7 +46,7 @@ def test_pct_change_numeric(self):
46
46
pnl .iat [2 , 3 ] = 60
47
47
48
48
msg = (
49
- "The 'fill_method' and 'limit' keywords in "
49
+ "The 'fill_method' keyword being not None and the 'limit' keyword in "
50
50
"DataFrame.pct_change are deprecated"
51
51
)
52
52
@@ -59,12 +59,11 @@ def test_pct_change_numeric(self):
59
59
60
60
def test_pct_change (self , datetime_frame ):
61
61
msg = (
62
- "The 'fill_method' and 'limit' keywords in "
62
+ "The 'fill_method' keyword being not None and the 'limit' keyword in "
63
63
"DataFrame.pct_change are deprecated"
64
64
)
65
65
66
- with tm .assert_produces_warning (FutureWarning , match = msg ):
67
- rs = datetime_frame .pct_change (fill_method = None )
66
+ rs = datetime_frame .pct_change (fill_method = None )
68
67
tm .assert_frame_equal (rs , datetime_frame / datetime_frame .shift (1 ) - 1 )
69
68
70
69
rs = datetime_frame .pct_change (2 )
@@ -110,7 +109,7 @@ def test_pct_change_periods_freq(
110
109
self , datetime_frame , freq , periods , fill_method , limit
111
110
):
112
111
msg = (
113
- "The 'fill_method' and 'limit' keywords in "
112
+ "The 'fill_method' keyword being not None and the 'limit' keyword in "
114
113
"DataFrame.pct_change are deprecated"
115
114
)
116
115
@@ -144,11 +143,12 @@ def test_pct_change_with_duplicated_indices(fill_method):
144
143
{0 : [np .nan , 1 , 2 , 3 , 9 , 18 ], 1 : [0 , 1 , np .nan , 3 , 9 , 18 ]}, index = ["a" , "b" ] * 3
145
144
)
146
145
146
+ warn = None if fill_method is None else FutureWarning
147
147
msg = (
148
- "The 'fill_method' and 'limit' keywords in "
148
+ "The 'fill_method' keyword being not None and the 'limit' keyword in "
149
149
"DataFrame.pct_change are deprecated"
150
150
)
151
- with tm .assert_produces_warning (FutureWarning , match = msg ):
151
+ with tm .assert_produces_warning (warn , match = msg ):
152
152
result = data .pct_change (fill_method = fill_method )
153
153
154
154
if fill_method is None :
0 commit comments