MCPcopy
hub / github.com/numpy/numpy / test_varmean_nomask

Method test_varmean_nomask

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

Source from the content-addressed store, hash-verified

4275 assert_almost_equal(z.mask, [[0, 1], [0, 0]])
4276
4277 def test_varmean_nomask(self):
4278 # gh-5769
4279 foo = array([1, 2, 3, 4], dtype='f8')
4280 bar = array([1, 2, 3, 4], dtype='f8')
4281 assert_equal(type(foo.mean()), np.float64)
4282 assert_equal(type(foo.var()), np.float64)
4283 assert (foo.mean() == bar.mean()) is np.bool(True)
4284
4285 # check array type is preserved and out works
4286 foo = array(np.arange(16).reshape((4, 4)), dtype='f8')
4287 bar = empty(4, dtype='f4')
4288 assert_equal(type(foo.mean(axis=1)), MaskedArray)
4289 assert_equal(type(foo.var(axis=1)), MaskedArray)
4290 assert_(foo.mean(axis=1, out=bar) is bar)
4291 assert_(foo.var(axis=1, out=bar) is bar)
4292
4293 def test_varstd(self):
4294 # Tests var & std on MaskedArrays.

Callers

nothing calls this directly

Calls 7

arrayFunction · 0.90
assert_equalFunction · 0.90
emptyFunction · 0.85
assert_Function · 0.85
reshapeMethod · 0.80
meanMethod · 0.45
varMethod · 0.45

Tested by

no test coverage detected