diff options
author | Gerrit Holl <gerrit.holl@utoronto.ca> | 2015-01-28 19:25:30 -0500 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2015-05-02 09:53:56 -0600 |
commit | d7ffaea9855834c6d1a51a788ff0e6ffbe929e01 (patch) | |
tree | d854c06ad060a654eacbc66c1d02061f64bcb528 | |
parent | a7d663f0f36c296caef7494d167b32407d6c3856 (diff) | |
download | numpy-d7ffaea9855834c6d1a51a788ff0e6ffbe929e01.tar.gz |
TST: Add test for fix to issue #2972
Add a test to TestMaskedArrayFunctions to verify that a masked
structures array created with masked_where has a structured mask. The
mask was previously unstructured, leading to bug #2972.
-rw-r--r-- | numpy/ma/tests/test_core.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/numpy/ma/tests/test_core.py b/numpy/ma/tests/test_core.py index f0d5d6788..ea266669e 100644 --- a/numpy/ma/tests/test_core.py +++ b/numpy/ma/tests/test_core.py @@ -3242,6 +3242,15 @@ class TestMaskedArrayFunctions(TestCase): test = masked_equal(a, 1) assert_equal(test.mask, [0, 1, 0, 0, 0, 0, 0, 0, 0, 0]) + def test_masked_where_structured(self): + # test that masked_where on a structured array sets a structured + # mask (see issue #2972) + a = np.zeros(10, dtype=[("A", "<f2"), ("B", "<f4")]) + am = np.ma.masked_where(a["A"]<5, a) + assert_equal(am.mask.dtype.names, am.dtype.names) + assert_equal(am["A"], + np.ma.masked_array(np.zeros(10), np.ones(10))) + def test_masked_otherfunctions(self): assert_equal(masked_inside(list(range(5)), 1, 3), [0, 199, 199, 199, 4]) |