diff options
author | behzad nouri <behzadnouri@gmail.com> | 2015-05-01 18:42:37 -0400 |
---|---|---|
committer | behzad nouri <behzadnouri@gmail.com> | 2015-05-04 07:27:44 -0400 |
commit | ba29c7b224618b069644e747d6e9236f88accad4 (patch) | |
tree | 239106fbb146bcad3409c3fd350e6bdecf98ef96 /numpy/lib/tests/test_function_base.py | |
parent | 63e8babb47709ff14b1d728fd46029edcbded70c (diff) | |
download | numpy-ba29c7b224618b069644e747d6e9236f88accad4.tar.gz |
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.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 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 |