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

Method test_keepdims_out

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

Source from the content-addressed store, hash-verified

4083 ]
4084 )
4085 def test_keepdims_out(self, axis):
4086 d = np.ones((3, 5, 7, 11))
4087 if axis is None:
4088 shape_out = (1,) * d.ndim
4089 else:
4090 axis_norm = normalize_axis_tuple(axis, d.ndim)
4091 shape_out = tuple(
4092 1 if i in axis_norm else d.shape[i] for i in range(d.ndim))
4093 out = np.empty(shape_out)
4094 result = np.median(d, axis=axis, keepdims=True, out=out)
4095 assert result is out
4096 assert_equal(result.shape, shape_out)
4097
4098 @pytest.mark.parametrize("dtype", ["m8[s]"])
4099 @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