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

Method test_basic_keepdims

numpy/ma/tests/test_extras.py:399–414  ·  view source on GitHub ↗
(self, x, axis, expected_avg,
                            weights, expected_wavg, expected_wsum)

Source from the content-addressed store, hash-verified

397 [1, 3], [[1.0, 5.0, 9.5]], [[4, 4, 4]])],
398 )
399 def test_basic_keepdims(self, x, axis, expected_avg,
400 weights, expected_wavg, expected_wsum):
401 avg = np.ma.average(x, axis=axis, keepdims=True)
402 assert avg.shape == np.shape(expected_avg)
403 assert_array_equal(avg, expected_avg)
404
405 wavg = np.ma.average(x, axis=axis, weights=weights, keepdims=True)
406 assert wavg.shape == np.shape(expected_wavg)
407 assert_array_equal(wavg, expected_wavg)
408
409 wavg, wsum = np.ma.average(x, axis=axis, weights=weights,
410 returned=True, keepdims=True)
411 assert wavg.shape == np.shape(expected_wavg)
412 assert_array_equal(wavg, expected_wavg)
413 assert wsum.shape == np.shape(expected_wsum)
414 assert_array_equal(wsum, expected_wsum)
415
416 def test_masked_weights(self):
417 # Test with masked weights.

Callers

nothing calls this directly

Calls 2

assert_array_equalFunction · 0.90
shapeMethod · 0.45

Tested by

no test coverage detected