MCPcopy Index your code
hub / github.com/numpy/numpy / test_zeros

Method test_zeros

numpy/ma/tests/test_core.py:3530–3550  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3528 assert_(np.may_share_memory(a.mask, b.mask))
3529
3530 def test_zeros(self):
3531 # Tests zeros/like
3532 datatype = [('a', int), ('b', float), ('c', '|S8')]
3533 a = masked_array([(1, 1.1, '1.1'), (2, 2.2, '2.2'), (3, 3.3, '3.3')],
3534 dtype=datatype)
3535 assert_equal(len(a.fill_value.item()), len(datatype))
3536
3537 b = zeros(len(a), dtype=datatype)
3538 assert_equal(b.shape, a.shape)
3539 assert_equal(b.fill_value, a.fill_value)
3540
3541 b = zeros_like(a)
3542 assert_equal(b.shape, a.shape)
3543 assert_equal(b.fill_value, a.fill_value)
3544
3545 # check zeros_like mask handling
3546 a = masked_array([1, 2, 3], mask=[False, True, False])
3547 b = zeros_like(a)
3548 assert_(not np.may_share_memory(a.mask, b.mask))
3549 b = a.view()
3550 assert_(np.may_share_memory(a.mask, b.mask))
3551
3552 def test_ones(self):
3553 # Tests ones/like

Callers

nothing calls this directly

Calls 6

assert_equalFunction · 0.90
zeros_likeFunction · 0.90
zerosFunction · 0.85
assert_Function · 0.85
itemMethod · 0.80
viewMethod · 0.45

Tested by

no test coverage detected