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

Method test_basic_keepdims

numpy/lib/tests/test_function_base.py:315–330  ·  view source on GitHub ↗
(self, x, axis, expected_avg,
                            weights, expected_wavg, expected_wsum)

Source from the content-addressed store, hash-verified

313 [1, 3], [[1.0, 5.0, 9.5]], [[4, 4, 4]])],
314 )
315 def test_basic_keepdims(self, x, axis, expected_avg,
316 weights, expected_wavg, expected_wsum):
317 avg = np.average(x, axis=axis, keepdims=True)
318 assert avg.shape == np.shape(expected_avg)
319 assert_array_equal(avg, expected_avg)
320
321 wavg = np.average(x, axis=axis, weights=weights, keepdims=True)
322 assert wavg.shape == np.shape(expected_wavg)
323 assert_array_equal(wavg, expected_wavg)
324
325 wavg, wsum = np.average(x, axis=axis, weights=weights, returned=True,
326 keepdims=True)
327 assert wavg.shape == np.shape(expected_wavg)
328 assert_array_equal(wavg, expected_wavg)
329 assert wsum.shape == np.shape(expected_wsum)
330 assert_array_equal(wsum, expected_wsum)
331
332 def test_weights(self):
333 y = np.arange(10)

Callers

nothing calls this directly

Calls 2

assert_array_equalFunction · 0.90
shapeMethod · 0.45

Tested by

no test coverage detected