MCPcopy Create free account
hub / github.com/numpy/numpy / test_set_fields_mask

Method test_set_fields_mask

numpy/ma/tests/test_mrecords.py:145–158  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

143 assert_equal(rdata.num.mask, [1, 0, 0])
144
145 def test_set_fields_mask(self):
146 # Tests setting the mask of a field.
147 base = self.base.copy()
148 # This one has already a mask....
149 mbase = base.view(mrecarray)
150 mbase['a'][-2] = masked
151 assert_equal(mbase.a, [1, 2, 3, 4, 5])
152 assert_equal(mbase.a._mask, [0, 1, 0, 1, 1])
153 # This one has not yet
154 mbase = fromarrays([np.arange(5), np.random.rand(5)],
155 dtype=[('a', int), ('b', float)])
156 mbase['a'][-2] = masked
157 assert_equal(mbase.a, [0, 1, 2, 3, 4])
158 assert_equal(mbase.a._mask, [0, 0, 0, 1, 0])
159
160 def test_set_mask(self):
161 base = self.base.copy()

Callers

nothing calls this directly

Calls 4

assert_equalFunction · 0.90
fromarraysFunction · 0.90
copyMethod · 0.45
viewMethod · 0.45

Tested by

no test coverage detected