summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_function_base.py
diff options
context:
space:
mode:
authorabel <aoun@cerfacs.fr>2021-10-19 17:55:06 +0200
committerSebastian Berg <sebastian@sipsolutions.net>2021-11-04 14:50:27 -0500
commit2a5422da7cb6759d75477738cc192fee3ca2a19c (patch)
tree530e72d3d295c84dc971bbd93a25773ffcc94a87 /numpy/lib/tests/test_function_base.py
parentd5e275b2bf65c1848203f6bff7606623793daeed (diff)
downloadnumpy-2a5422da7cb6759d75477738cc192fee3ca2a19c.tar.gz
Fix issue with nan scalar
Also added unit test for it.
Diffstat (limited to 'numpy/lib/tests/test_function_base.py')
-rw-r--r--numpy/lib/tests/test_function_base.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py
index d59f3a85d..f9854c568 100644
--- a/numpy/lib/tests/test_function_base.py
+++ b/numpy/lib/tests/test_function_base.py
@@ -3475,6 +3475,12 @@ class TestQuantile:
quantile = np.quantile(arr, p0)
assert_equal(np.sort(quantile), quantile)
+ def test_quantile_scalar_nan(self):
+ a = np.array([[10., 7., 4.], [3., 2., 1.]])
+ a[0][1] = np.nan
+ actual = np.quantile(a, 0.5)
+ assert np.isscalar(actual)
+ assert_equal(np.quantile(a, 0.5), np.nan)
class TestLerp:
@hypothesis.given(t0=st.floats(allow_nan=False, allow_infinity=False,