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

Method test_keepdims_out

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

Source from the content-addressed store, hash-verified

4728 ]
4729 )
4730 def test_keepdims_out(self, axis):
4731 d = np.ones((3, 5, 7, 11))
4732 if axis is None:
4733 shape_out = (1,) * d.ndim
4734 else:
4735 axis_norm = normalize_axis_tuple(axis, d.ndim)
4736 shape_out = tuple(
4737 1 if i in axis_norm else d.shape[i] for i in range(d.ndim))
4738 out = np.empty(shape_out)
4739 result = np.median(d, axis=axis, keepdims=True, out=out)
4740 assert result is out
4741 assert_equal(result.shape, shape_out)
4742
4743 @pytest.mark.parametrize("dtype", ["m8[s]"])
4744 @pytest.mark.parametrize("pos", [0, 23, 10])

Callers

nothing calls this directly

Calls 2

normalize_axis_tupleFunction · 0.90
assert_equalFunction · 0.90

Tested by

no test coverage detected