@@ -29,7 +29,7 @@ def test_pct_change_with_nas(
2929 obj = frame_or_series (vals )
3030
3131 msg = (
32- "The 'fill_method' and 'limit' keywords in "
32+ "The 'fill_method' keyword being not None and the 'limit' keyword in "
3333 f"{ type (obj ).__name__ } .pct_change are deprecated"
3434 )
3535 with tm .assert_produces_warning (FutureWarning , match = msg ):
@@ -46,7 +46,7 @@ def test_pct_change_numeric(self):
4646 pnl .iat [2 , 3 ] = 60
4747
4848 msg = (
49- "The 'fill_method' and 'limit' keywords in "
49+ "The 'fill_method' keyword being not None and the 'limit' keyword in "
5050 "DataFrame.pct_change are deprecated"
5151 )
5252
@@ -59,12 +59,11 @@ def test_pct_change_numeric(self):
5959
6060 def test_pct_change (self , datetime_frame ):
6161 msg = (
62- "The 'fill_method' and 'limit' keywords in "
62+ "The 'fill_method' keyword being not None and the 'limit' keyword in "
6363 "DataFrame.pct_change are deprecated"
6464 )
6565
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 )
6867 tm .assert_frame_equal (rs , datetime_frame / datetime_frame .shift (1 ) - 1 )
6968
7069 rs = datetime_frame .pct_change (2 )
@@ -110,7 +109,7 @@ def test_pct_change_periods_freq(
110109 self , datetime_frame , freq , periods , fill_method , limit
111110 ):
112111 msg = (
113- "The 'fill_method' and 'limit' keywords in "
112+ "The 'fill_method' keyword being not None and the 'limit' keyword in "
114113 "DataFrame.pct_change are deprecated"
115114 )
116115
@@ -144,11 +143,12 @@ def test_pct_change_with_duplicated_indices(fill_method):
144143 {0 : [np .nan , 1 , 2 , 3 , 9 , 18 ], 1 : [0 , 1 , np .nan , 3 , 9 , 18 ]}, index = ["a" , "b" ] * 3
145144 )
146145
146+ warn = None if fill_method is None else FutureWarning
147147 msg = (
148- "The 'fill_method' and 'limit' keywords in "
148+ "The 'fill_method' keyword being not None and the 'limit' keyword in "
149149 "DataFrame.pct_change are deprecated"
150150 )
151- with tm .assert_produces_warning (FutureWarning , match = msg ):
151+ with tm .assert_produces_warning (warn , match = msg ):
152152 result = data .pct_change (fill_method = fill_method )
153153
154154 if fill_method is None :
0 commit comments