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

Method _do_add_test

numpy/ma/tests/test_core.py:5578–5590  ·  view source on GitHub ↗
(self, add)

Source from the content-addressed store, hash-verified

5576
5577class TestMaskedConstant:
5578 def _do_add_test(self, add):
5579 # sanity check
5580 assert_(add(np.ma.masked, 1) is np.ma.masked)
5581
5582 # now try with a vector
5583 vector = np.array([1, 2, 3])
5584 result = add(np.ma.masked, vector)
5585
5586 # lots of things could go wrong here
5587 assert_(result is not np.ma.masked)
5588 assert_(not isinstance(result, np.ma.core.MaskedConstant))
5589 assert_equal(result.shape, vector.shape)
5590 assert_equal(np.ma.getmask(result), np.ones(vector.shape, dtype=bool))
5591
5592 def test_ufunc(self):
5593 self._do_add_test(np.add)

Callers 2

test_ufuncMethod · 0.95
test_operatorMethod · 0.95

Calls 3

assert_equalFunction · 0.90
assert_Function · 0.85
addFunction · 0.85

Tested by

no test coverage detected