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

Method test_basic_keepdims

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

Source from the content-addressed store, hash-verified

309 [1, 3], [[1.0, 5.0, 9.5]], [[4, 4, 4]])],
310 )
311 def test_basic_keepdims(self, x, axis, expected_avg,
312 weights, expected_wavg, expected_wsum):
313 avg = np.ma.average(x, axis=axis, keepdims=True)
314 assert avg.shape == np.shape(expected_avg)
315 assert_array_equal(avg, expected_avg)
316
317 wavg = np.ma.average(x, axis=axis, weights=weights, keepdims=True)
318 assert wavg.shape == np.shape(expected_wavg)
319 assert_array_equal(wavg, expected_wavg)
320
321 wavg, wsum = np.ma.average(x, axis=axis, weights=weights,
322 returned=True, keepdims=True)
323 assert wavg.shape == np.shape(expected_wavg)
324 assert_array_equal(wavg, expected_wavg)
325 assert wsum.shape == np.shape(expected_wsum)
326 assert_array_equal(wsum, expected_wsum)
327
328 def test_masked_weights(self):
329 # 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