summaryrefslogtreecommitdiff
path: root/numpy/ma/tests
diff options
context:
space:
mode:
authorMarten van Kerkwijk <mhvk@astro.utoronto.ca>2018-11-30 11:33:36 -0500
committerMarten van Kerkwijk <mhvk@astro.utoronto.ca>2018-11-30 11:33:36 -0500
commit1842ea98e764d48e4d82636c995b86d1926fd124 (patch)
tree2a8b7c3970c02ae7bf6eb621c662ae86e897d111 /numpy/ma/tests
parentb3a435305082699c26445630d9c79587d51ba9f1 (diff)
downloadnumpy-1842ea98e764d48e4d82636c995b86d1926fd124.tar.gz
BUG: IndexError for empty list on structured MaskedArray.
This should give an empty result, not an error. The problem was that the empty list was interpreted as a list of strings.
Diffstat (limited to 'numpy/ma/tests')
-rw-r--r--numpy/ma/tests/test_regression.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/numpy/ma/tests/test_regression.py b/numpy/ma/tests/test_regression.py
index 96c418a51..67020d8e0 100644
--- a/numpy/ma/tests/test_regression.py
+++ b/numpy/ma/tests/test_regression.py
@@ -84,3 +84,8 @@ class TestRegression(object):
assert_(a.mask.shape == (2,))
assert_(b.shape == (2, 2))
assert_(b.mask.shape == (2, 2))
+
+ def test_empty_list_on_structured(self):
+ # See gh-12464. Indexing with empty list should give empty result.
+ ma = np.ma.MaskedArray([(1, 1.), (2, 2.), (3, 3.)], dtype='i4,f4')
+ assert_array_equal(ma[[]], ma[:0])