MCPcopy Index your code
hub / github.com/numpy/numpy / test_basic

Method test_basic

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

Source from the content-addressed store, hash-verified

341class TestAverage:
342
343 def test_basic(self):
344 y1 = np.array([1, 2, 3])
345 assert_(average(y1, axis=0) == 2.)
346 y2 = np.array([1., 2., 3.])
347 assert_(average(y2, axis=0) == 2.)
348 y3 = [0., 0., 0.]
349 assert_(average(y3, axis=0) == 0.)
350
351 y4 = np.ones((4, 4))
352 y4[0, 1] = 0
353 y4[1, 0] = 2
354 assert_almost_equal(y4.mean(0), average(y4, 0))
355 assert_almost_equal(y4.mean(1), average(y4, 1))
356
357 y5 = rand(5, 5)
358 assert_almost_equal(y5.mean(0), average(y5, 0))
359 assert_almost_equal(y5.mean(1), average(y5, 1))
360
361 @pytest.mark.parametrize(
362 '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