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

Method test_set_fields_mask

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

Source from the content-addressed store, hash-verified

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