diff options
author | pierregm <pierregm@localhost> | 2010-02-08 06:21:33 +0000 |
---|---|---|
committer | pierregm <pierregm@localhost> | 2010-02-08 06:21:33 +0000 |
commit | 53f1ee985c07924eec61133f8c6b8f27c481ac84 (patch) | |
tree | d75b78bd6804fe93648825465564e61339c61f30 /numpy/ma/tests | |
parent | 5bad51bf3afc9d2256e9f6a5a1883233b3065ddd (diff) | |
download | numpy-53f1ee985c07924eec61133f8c6b8f27c481ac84.tar.gz |
* Make sure _fill_value is never None for structured masked arrays
Diffstat (limited to 'numpy/ma/tests')
-rw-r--r-- | numpy/ma/tests/test_core.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/numpy/ma/tests/test_core.py b/numpy/ma/tests/test_core.py index b849d0c48..74bd2f722 100644 --- a/numpy/ma/tests/test_core.py +++ b/numpy/ma/tests/test_core.py @@ -503,7 +503,7 @@ class TestMaskedArray(TestCase): def test_filled_w_mvoid(self): "Test filled w/ mvoid" ndtype = [('a', int), ('b', float)] - a = mvoid(np.array((1, 2)), mask=[(0, 1)], dtype=ndtype) + a = mvoid((1, 2.), mask=[(0, 1)], dtype=ndtype) # Filled using default test = a.filled() assert_equal(tuple(test), (1, default_fill_value(1.))) @@ -1457,6 +1457,19 @@ class TestFillingValues(TestCase): assert_equal(tt._fill_value, np.array(10)) assert_equal(tuple(t.fill_value), (10, default_fill_value(0))) + def test_fillvalue_implicit_structured_array(self): + "Check that fill_value is always defined for structured arrays" + ndtype = ('b', float) + adtype = ('a', float) + a = array([(1.,), (2.,)], mask=[(False,), (False,)], + fill_value=(np.nan,), dtype=np.dtype([adtype])) + b = empty(a.shape, dtype=[adtype, ndtype]) + b['a'] = a['a'] + b['a'].set_fill_value(a['a'].fill_value) + f = b._fill_value[()] + assert(np.isnan(f[0])) + assert_equal(f[-1], default_fill_value(1.)) + #------------------------------------------------------------------------------ class TestUfuncs(TestCase): |