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

Method test_varmean_nomask

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

Source from the content-addressed store, hash-verified

4038 assert_almost_equal(z.mask, [[0, 1], [0, 0]])
4039
4040 def test_varmean_nomask(self):
4041 # gh-5769
4042 foo = array([1,2,3,4], dtype='f8')
4043 bar = array([1,2,3,4], dtype='f8')
4044 assert_equal(type(foo.mean()), np.float64)
4045 assert_equal(type(foo.var()), np.float64)
4046 assert((foo.mean() == bar.mean()) is np.bool_(True))
4047
4048 # check array type is preserved and out works
4049 foo = array(np.arange(16).reshape((4,4)), dtype='f8')
4050 bar = empty(4, dtype='f4')
4051 assert_equal(type(foo.mean(axis=1)), MaskedArray)
4052 assert_equal(type(foo.var(axis=1)), MaskedArray)
4053 assert_(foo.mean(axis=1, out=bar) is bar)
4054 assert_(foo.var(axis=1, out=bar) is bar)
4055
4056 def test_varstd(self):
4057 # Tests var & std on MaskedArrays.

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected