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

Method test_filled

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

Source from the content-addressed store, hash-verified

293 assert_equal_records(mrec_._mask, mrec._mask)
294
295 def test_filled(self):
296 # Test filling the array
297 _a = ma.array([1, 2, 3], mask=[0, 0, 1], dtype=int)
298 _b = ma.array([1.1, 2.2, 3.3], mask=[0, 0, 1], dtype=float)
299 _c = ma.array(['one', 'two', 'three'], mask=[0, 0, 1], dtype='|S8')
300 ddtype = [('a', int), ('b', float), ('c', '|S8')]
301 mrec = fromarrays([_a, _b, _c], dtype=ddtype,
302 fill_value=(99999, 99999., 'N/A'))
303 mrecfilled = mrec.filled()
304 assert_equal(mrecfilled['a'], np.array((1, 2, 99999), dtype=int))
305 assert_equal(mrecfilled['b'], np.array((1.1, 2.2, 99999.),
306 dtype=float))
307 assert_equal(mrecfilled['c'], np.array(('one', 'two', 'N/A'),
308 dtype='|S8'))
309
310 def test_tolist(self):
311 # Test tolist.

Callers

nothing calls this directly

Calls 3

fromarraysFunction · 0.90
assert_equalFunction · 0.90
filledMethod · 0.45

Tested by

no test coverage detected