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

Method test_argpartition_empty_array

numpy/_core/tests/test_multiarray.py:3360–3370  ·  view source on GitHub ↗
(self, kth_dtype)

Source from the content-addressed store, hash-verified

3358
3359 @pytest.mark.parametrize("kth_dtype", np.typecodes["AllInteger"])
3360 def test_argpartition_empty_array(self, kth_dtype):
3361 # check axis handling for multidimensional empty arrays
3362 kth = np.array(0, dtype=kth_dtype)[()]
3363 a = np.array([]).reshape((3, 2, 1, 0))
3364 for axis in range(-a.ndim, a.ndim):
3365 msg = f'test empty array argpartition with axis={axis}'
3366 assert_equal(np.partition(a, kth, axis=axis),
3367 np.zeros_like(a, dtype=np.intp), msg)
3368 msg = 'test empty array argpartition with axis=None'
3369 assert_equal(np.partition(a, kth, axis=None),
3370 np.zeros_like(a.ravel(), dtype=np.intp), msg)
3371
3372 def test_partition(self):
3373 d = np.arange(10)

Callers

nothing calls this directly

Calls 5

assert_equalFunction · 0.90
reshapeMethod · 0.80
zeros_likeMethod · 0.80
partitionMethod · 0.45
ravelMethod · 0.45

Tested by

no test coverage detected