Skip to content

Commit 4eea34a

Browse files
committed
Refactored and moved exception throwing test to a new function for Rolling.quantile().
1 parent 8b1e020 commit 4eea34a

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

pandas/tests/test_window.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -1084,14 +1084,15 @@ def alt(x):
10841084

10851085
self._check_moment_func(f, alt, name='quantile', quantile=q)
10861086

1087-
self.assertRaises(ValueError, mom.rolling_quantile,
1088-
np.array([1, 2, 3]), window=3, quantile=-0.1)
1087+
def test_rolling_quantile_param(self):
1088+
ser = Series([0.0, .1, .5, .9, 1.0])
10891089

1090-
self.assertRaises(ValueError, mom.rolling_quantile,
1091-
np.array([1, 2, 3]), window=3, quantile=10)
1090+
with self.assertRaises(ValueError):
1091+
ser.rolling(3).quantile(-0.1)
1092+
ser.rolling(3).quantile(10.0)
10921093

1093-
self.assertRaises(TypeError, mom.rolling_quantile,
1094-
np.array([1, 2, 3]), window=3, quantile='foo')
1094+
with self.assertRaises(TypeError):
1095+
ser.rolling(3).quantile('foo')
10951096

10961097
def test_rolling_apply(self):
10971098
# suppress warnings about empty slices, as we are deliberately testing

0 commit comments

Comments
 (0)