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

Method _do_add_test

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

Source from the content-addressed store, hash-verified

5315
5316class TestMaskedConstant:
5317 def _do_add_test(self, add):
5318 # sanity check
5319 assert_(add(np.ma.masked, 1) is np.ma.masked)
5320
5321 # now try with a vector
5322 vector = np.array([1, 2, 3])
5323 result = add(np.ma.masked, vector)
5324
5325 # lots of things could go wrong here
5326 assert_(result is not np.ma.masked)
5327 assert_(not isinstance(result, np.ma.core.MaskedConstant))
5328 assert_equal(result.shape, vector.shape)
5329 assert_equal(np.ma.getmask(result), np.ones(vector.shape, dtype=bool))
5330
5331 def test_ufunc(self):
5332 self._do_add_test(np.add)

Callers 2

test_ufuncMethod · 0.95
test_operatorMethod · 0.95

Calls 3

addFunction · 0.90
assert_equalFunction · 0.90
assert_Function · 0.50

Tested by

no test coverage detected