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

Method test_argpartition_empty_array

numpy/core/tests/test_multiarray.py:2774–2785  ·  view source on GitHub ↗
(self, kth_dtype)

Source from the content-addressed store, hash-verified

2772
2773 @pytest.mark.parametrize("kth_dtype", np.typecodes["AllInteger"])
2774 def test_argpartition_empty_array(self, kth_dtype):
2775 # check axis handling for multidimensional empty arrays
2776 kth = np.array(0, dtype=kth_dtype)[()]
2777 a = np.array([])
2778 a.shape = (3, 2, 1, 0)
2779 for axis in range(-a.ndim, a.ndim):
2780 msg = 'test empty array argpartition with axis={0}'.format(axis)
2781 assert_equal(np.partition(a, kth, axis=axis),
2782 np.zeros_like(a, dtype=np.intp), msg)
2783 msg = 'test empty array argpartition with axis=None'
2784 assert_equal(np.partition(a, kth, axis=None),
2785 np.zeros_like(a.ravel(), dtype=np.intp), msg)
2786
2787 def test_partition(self):
2788 d = np.arange(10)

Callers

nothing calls this directly

Calls 3

assert_equalFunction · 0.90
partitionMethod · 0.45
ravelMethod · 0.45

Tested by

no test coverage detected