diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2014-08-24 11:10:39 -0600 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2014-08-24 11:10:39 -0600 |
commit | 14e4cc3aa8bc6e01d6494860c7de6bf9ec0ab86b (patch) | |
tree | a9a9dedeb9aa5773a287c6a8b65c865e621d03ab /numpy/lib/tests | |
parent | c9dad32a1b5b360807f625ec49cac0a6537033bc (diff) | |
parent | 040d0408f4cdb0a472e654acd68c8e1c3fbd84f7 (diff) | |
download | numpy-14e4cc3aa8bc6e01d6494860c7de6bf9ec0ab86b.tar.gz |
Merge pull request #4989 from juliantaylor/percentile-fix
BUG: don't overwrite input percentile arrays
Diffstat (limited to 'numpy/lib/tests')
-rw-r--r-- | numpy/lib/tests/test_function_base.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index ac677a308..ee3000547 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -1865,6 +1865,14 @@ class TestScoreatpercentile(TestCase): np.percentile(a, [50]) assert_equal(a, np.array([2, 3, 4, 1])) + def test_no_p_overwrite(self): + p = np.linspace(0., 100., num=5) + np.percentile(np.arange(100.), p, interpolation="midpoint") + assert_array_equal(p, np.linspace(0., 100., num=5)) + p = np.linspace(0., 100., num=5).tolist() + np.percentile(np.arange(100.), p, interpolation="midpoint") + assert_array_equal(p, np.linspace(0., 100., num=5).tolist()) + def test_percentile_overwrite(self): a = np.array([2, 3, 4, 1]) b = np.percentile(a, [50], overwrite_input=True) |