From 9316110a42c370616cbb80ae3e1769534d04de10 Mon Sep 17 00:00:00 2001 From: Jonathan Helmus Date: Mon, 16 Sep 2013 10:44:26 -0600 Subject: 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. --- numpy/lib/tests/test_function_base.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'numpy/lib/tests/test_function_base.py') 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): -- cgit v1.2.1