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

Method test_testAverage4

numpy/ma/tests/test_extras.py:282–289  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

280 assert_equal(a2dma, [1.5, 4.0])
281
282 def test_testAverage4(self):
283 # Test that `keepdims` works with average
284 x = np.array([2, 3, 4]).reshape(3, 1)
285 b = np.ma.array(x, mask=[[False], [False], [True]])
286 w = np.array([4, 5, 6]).reshape(3, 1)
287 actual = average(b, weights=w, axis=1, keepdims=True)
288 desired = masked_array([[2.], [3.], [4.]], [[False], [False], [True]])
289 assert_equal(actual, desired)
290
291 def test_weight_and_input_dims_different(self):
292 # this test mirrors a test for np.average()

Callers

nothing calls this directly

Calls 3

averageFunction · 0.90
assert_equalFunction · 0.90
reshapeMethod · 0.80

Tested by

no test coverage detected