(self)
| 5058 | _test_index(-2) # All element masked |
| 5059 | |
| 5060 | def test_setitem(self): |
| 5061 | # Issue 4866: check that one can set individual items in [record][col] |
| 5062 | # and [col][record] order |
| 5063 | ndtype = np.dtype([('a', float), ('b', int)]) |
| 5064 | ma = np.ma.MaskedArray([(1.0, 1), (2.0, 2)], dtype=ndtype) |
| 5065 | ma['a'][1] = 3.0 |
| 5066 | assert_equal(ma['a'], np.array([1.0, 3.0])) |
| 5067 | ma[1]['a'] = 4.0 |
| 5068 | assert_equal(ma['a'], np.array([1.0, 4.0])) |
| 5069 | # Issue 2403 |
| 5070 | mdtype = np.dtype([('a', bool), ('b', bool)]) |
| 5071 | # soft mask |
| 5072 | control = np.array([(False, True), (True, True)], dtype=mdtype) |
| 5073 | a = np.ma.masked_all((2,), dtype=ndtype) |
| 5074 | a['a'][0] = 2 |
| 5075 | assert_equal(a.mask, control) |
| 5076 | a = np.ma.masked_all((2,), dtype=ndtype) |
| 5077 | a[0]['a'] = 2 |
| 5078 | assert_equal(a.mask, control) |
| 5079 | # hard mask |
| 5080 | control = np.array([(True, True), (True, True)], dtype=mdtype) |
| 5081 | a = np.ma.masked_all((2,), dtype=ndtype) |
| 5082 | a.harden_mask() |
| 5083 | a['a'][0] = 2 |
| 5084 | assert_equal(a.mask, control) |
| 5085 | a = np.ma.masked_all((2,), dtype=ndtype) |
| 5086 | a.harden_mask() |
| 5087 | a[0]['a'] = 2 |
| 5088 | assert_equal(a.mask, control) |
| 5089 | |
| 5090 | def test_setitem_scalar(self): |
| 5091 | # 8510 |
nothing calls this directly
no test coverage detected