@@ -60,7 +60,6 @@ def test_rolling(self):
6060 r = g .rolling (window = 4 )
6161
6262 for f in ["sum" , "mean" , "min" , "max" , "count" , "kurt" , "skew" ]:
63-
6463 result = getattr (r , f )()
6564 expected = g .apply (lambda x : getattr (x .rolling (4 ), f )())
6665 tm .assert_frame_equal (result , expected )
@@ -70,8 +69,16 @@ def test_rolling(self):
7069 expected = g .apply (lambda x : getattr (x .rolling (4 ), f )(ddof = 1 ))
7170 tm .assert_frame_equal (result , expected )
7271
73- result = r .quantile (0.5 )
74- expected = g .apply (lambda x : x .rolling (4 ).quantile (0.5 ))
72+ @pytest .mark .parametrize (
73+ "interpolation" , ["linear" , "lower" , "higher" , "midpoint" , "nearest" ]
74+ )
75+ def test_rolling_quantile (self , interpolation ):
76+ g = self .frame .groupby ("A" )
77+ r = g .rolling (window = 4 )
78+ result = r .quantile (0.4 , interpolation = interpolation )
79+ expected = g .apply (
80+ lambda x : x .rolling (4 ).quantile (0.4 , interpolation = interpolation )
81+ )
7582 tm .assert_frame_equal (result , expected )
7683
7784 def test_rolling_corr_cov (self ):
@@ -142,8 +149,16 @@ def test_expanding(self):
142149 expected = g .apply (lambda x : getattr (x .expanding (), f )(ddof = 0 ))
143150 tm .assert_frame_equal (result , expected )
144151
145- result = r .quantile (0.5 )
146- expected = g .apply (lambda x : x .expanding ().quantile (0.5 ))
152+ @pytest .mark .parametrize (
153+ "interpolation" , ["linear" , "lower" , "higher" , "midpoint" , "nearest" ]
154+ )
155+ def test_expanding_quantile (self , interpolation ):
156+ g = self .frame .groupby ("A" )
157+ r = g .expanding ()
158+ result = r .quantile (0.4 , interpolation = interpolation )
159+ expected = g .apply (
160+ lambda x : x .expanding ().quantile (0.4 , interpolation = interpolation )
161+ )
147162 tm .assert_frame_equal (result , expected )
148163
149164 def test_expanding_corr_cov (self ):
0 commit comments