summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_function_base.py
diff options
context:
space:
mode:
authorJonathan Helmus <jjhelmus@gmail.com>2013-09-16 10:44:26 -0600
committerJonathan Helmus <jjhelmus@gmail.com>2013-09-16 10:44:26 -0600
commit9316110a42c370616cbb80ae3e1769534d04de10 (patch)
tree695102877508ccc5e47a309681809c6f34cbc6c3 /numpy/lib/tests/test_function_base.py
parent9dd212cee1c9ccab6013d52e776bcf6ef712a5e0 (diff)
downloadnumpy-9316110a42c370616cbb80ae3e1769534d04de10.tar.gz
TST: note on overwrite_input parameter in percentile
* added note that `overwrite_input` has not effect when `a` is not an array in the percentile function. * added unit test to verify that no error is raised when `a` is not an array and `overwrite_input` is True.
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 a69c82e18..dd0b6e0ee 100644
--- a/numpy/lib/tests/test_function_base.py
+++ b/numpy/lib/tests/test_function_base.py
@@ -1530,9 +1530,19 @@ class TestScoreatpercentile(TestCase):
np.percentile(a, [50], overwrite_input=False)
assert_equal(a, np.array([2, 3, 4, 1]))
+ a = np.array([2, 3, 4, 1])
np.percentile(a, [50])
assert_equal(a, np.array([2, 3, 4, 1]))
+ def test_percentile_overwrite(self):
+ a = np.array([2, 3, 4, 1])
+ b = np.percentile(a, [50], overwrite_input=True)
+ assert_equal(b, np.array([2.5]))
+
+ b = np.percentile([2, 3, 4, 1], [50], overwrite_input=True)
+ assert_equal(b, np.array([2.5]))
+
+
class TestMedian(TestCase):
def test_basic(self):