summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_function_base.py
diff options
context:
space:
mode:
authorJaime <jaime.frio@gmail.com>2015-05-04 21:03:22 -0700
committerJaime <jaime.frio@gmail.com>2015-05-04 21:03:22 -0700
commitbdfea0af2036e74396b78e076e90170eddbbf670 (patch)
treeb0d7f554da4cb5b6a4cc5afdd318f447f88952fe /numpy/lib/tests/test_function_base.py
parent93bcedfd4e31e4e1eb92a5abf0de46464a154953 (diff)
parentba29c7b224618b069644e747d6e9236f88accad4 (diff)
downloadnumpy-bdfea0af2036e74396b78e076e90170eddbbf670.tar.gz
Merge pull request #5821 from behzadnouri/place-segfault
BUG: fixes segfault in np.place when vals is empty
Diffstat (limited to 'numpy/lib/tests/test_function_base.py')
-rw-r--r--numpy/lib/tests/test_function_base.py8
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 cf9fcf5e2..12f9d414b 100644
--- a/numpy/lib/tests/test_function_base.py
+++ b/numpy/lib/tests/test_function_base.py
@@ -626,6 +626,14 @@ class TestExtins(TestCase):
place(a, [0, 1, 0, 1, 0, 1, 0], [2, 4, 6])
assert_array_equal(a, [1, 2, 3, 4, 5, 6, 7])
+ place(a, np.zeros(7), [])
+ assert_array_equal(a, np.arange(1, 8))
+
+ place(a, [1, 0, 1, 0, 1, 0, 1], [8, 9])
+ assert_array_equal(a, [8, 2, 9, 4, 8, 6, 9])
+ assert_raises_regex(ValueError, "Cannot insert from an empty array",
+ lambda: place(a, [0, 0, 0, 0, 0, 1, 0], []))
+
def test_both(self):
a = rand(10)
mask = a > 0.5