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

Method test_mean

numpy/core/tests/test_numeric.py:130–139  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

128 assert_equal(out, tgt)
129
130 def test_mean(self):
131 A = [[1, 2, 3], [4, 5, 6]]
132 assert_(np.mean(A) == 3.5)
133 assert_(np.all(np.mean(A, 0) == np.array([2.5, 3.5, 4.5])))
134 assert_(np.all(np.mean(A, 1) == np.array([2., 5.])))
135
136 with warnings.catch_warnings(record=True) as w:
137 warnings.filterwarnings('always', '', RuntimeWarning)
138 assert_(np.isnan(np.mean([])))
139 assert_(w[0].category is RuntimeWarning)
140
141 def test_ptp(self):
142 a = [3, 4, 5, 10, -3, -5, 6.0]

Callers

nothing calls this directly

Calls 3

assert_Function · 0.90
meanMethod · 0.45
allMethod · 0.45

Tested by

no test coverage detected