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

Method test_keepdims_out

numpy/lib/tests/test_function_base.py:3422–3435  ·  view source on GitHub ↗
(self, q, axis)

Source from the content-addressed store, hash-verified

3420 ]
3421 )
3422 def test_keepdims_out(self, q, axis):
3423 d = np.ones((3, 5, 7, 11))
3424 if axis is None:
3425 shape_out = (1,) * d.ndim
3426 else:
3427 axis_norm = normalize_axis_tuple(axis, d.ndim)
3428 shape_out = tuple(
3429 1 if i in axis_norm else d.shape[i] for i in range(d.ndim))
3430 shape_out = np.shape(q) + shape_out
3431
3432 out = np.empty(shape_out)
3433 result = np.percentile(d, q, axis=axis, keepdims=True, out=out)
3434 assert result is out
3435 assert_equal(result.shape, shape_out)
3436
3437 def test_out(self):
3438 o = np.zeros((4,))

Callers

nothing calls this directly

Calls 3

normalize_axis_tupleFunction · 0.90
assert_equalFunction · 0.90
shapeMethod · 0.45

Tested by

no test coverage detected