summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_function_base.py
diff options
context:
space:
mode:
authorEric Mariasis <ericmariasis829@gmail.com>2020-02-01 15:06:34 -0500
committerSebastian Berg <sebastian@sipsolutions.net>2020-02-28 09:44:50 -0500
commit6361c2cd62b25a4b8602c647ac64466d9cc011fd (patch)
treeb264b95ed103d829fe659c1368be695bb2b04b5c /numpy/lib/tests/test_function_base.py
parent94d3302039856667988f82d637f9a35998d19a79 (diff)
downloadnumpy-6361c2cd62b25a4b8602c647ac64466d9cc011fd.tar.gz
BUG: Fixing result of np quantile edge case
Diffstat (limited to 'numpy/lib/tests/test_function_base.py')
-rw-r--r--numpy/lib/tests/test_function_base.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py
index 7953de15d..83fbd8bcc 100644
--- a/numpy/lib/tests/test_function_base.py
+++ b/numpy/lib/tests/test_function_base.py
@@ -2967,6 +2967,16 @@ class TestQuantile:
assert_equal(np.quantile(x, 1), 3.5)
assert_equal(np.quantile(x, 0.5), 1.75)
+ def test_correct_quantile_value(self):
+ a = np.array([True])
+ tf_quant = np.quantile(True, False)
+ assert_equal(tf_quant, a[0])
+ assert_equal(type(tf_quant), a.dtype)
+ a = np.array([False, True, True])
+ quant_res = np.quantile(a, a)
+ assert_array_equal(quant_res, a)
+ assert_equal(a.dtype, quant_res.dtype)
+
def test_fraction(self):
# fractional input, integral quantile
x = [Fraction(i, 2) for i in range(8)]