summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/core/tests/test_deprecations.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/numpy/core/tests/test_deprecations.py b/numpy/core/tests/test_deprecations.py
index a1b379d92..93e07216b 100644
--- a/numpy/core/tests/test_deprecations.py
+++ b/numpy/core/tests/test_deprecations.py
@@ -1230,3 +1230,23 @@ class TestMachAr(_DeprecationTestCase):
def test_deprecated_attr(self):
finfo = np.finfo(float)
self.assert_deprecated(lambda: getattr(finfo, "machar"))
+
+
+class TestQuantileInterpolationDeprecation(_DeprecationTestCase):
+ # Deprecated 2021-11-08, NumPy 1.22
+ @pytest.mark.parametrize("func",
+ [np.percentile, np.quantile, np.nanpercentile, np.nanquantile])
+ def test_deprecated(self, func):
+ self.assert_deprecated(
+ lambda: func([0., 1.], 0., interpolation="linear"))
+ self.assert_deprecated(
+ lambda: func([0., 1.], 0., interpolation="nearest"))
+
+ @pytest.mark.parametrize("func",
+ [np.percentile, np.quantile, np.nanpercentile, np.nanquantile])
+ def test_both_passed(self, func):
+ with warnings.catch_warnings():
+ # catch the warning, but make sure it does not raise:
+ warnings.simplefilter("always", DeprecationWarning)
+ with pytest.raises(TypeError):
+ func([0., 1.], 0., interpolation="nearest", method="nearest")