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

Method test_basic

numpy/lib/tests/test_function_base.py:291–307  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

289class TestAverage:
290
291 def test_basic(self):
292 y1 = np.array([1, 2, 3])
293 assert_(average(y1, axis=0) == 2.)
294 y2 = np.array([1., 2., 3.])
295 assert_(average(y2, axis=0) == 2.)
296 y3 = [0., 0., 0.]
297 assert_(average(y3, axis=0) == 0.)
298
299 y4 = np.ones((4, 4))
300 y4[0, 1] = 0
301 y4[1, 0] = 2
302 assert_almost_equal(y4.mean(0), average(y4, 0))
303 assert_almost_equal(y4.mean(1), average(y4, 1))
304
305 y5 = rand(5, 5)
306 assert_almost_equal(y5.mean(0), average(y5, 0))
307 assert_almost_equal(y5.mean(1), average(y5, 1))
308
309 @pytest.mark.parametrize(
310 'x, axis, expected_avg, weights, expected_wavg, expected_wsum',

Callers

nothing calls this directly

Calls 5

assert_Function · 0.90
averageFunction · 0.90
assert_almost_equalFunction · 0.90
randFunction · 0.85
meanMethod · 0.45

Tested by

no test coverage detected