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

Method test_partition_empty_array

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

Source from the content-addressed store, hash-verified

2760
2761 @pytest.mark.parametrize("kth_dtype", np.typecodes["AllInteger"])
2762 def test_partition_empty_array(self, kth_dtype):
2763 # check axis handling for multidimensional empty arrays
2764 kth = np.array(0, dtype=kth_dtype)[()]
2765 a = np.array([])
2766 a.shape = (3, 2, 1, 0)
2767 for axis in range(-a.ndim, a.ndim):
2768 msg = 'test empty array partition with axis={0}'.format(axis)
2769 assert_equal(np.partition(a, kth, axis=axis), a, msg)
2770 msg = 'test empty array partition with axis=None'
2771 assert_equal(np.partition(a, kth, axis=None), a.ravel(), msg)
2772
2773 @pytest.mark.parametrize("kth_dtype", np.typecodes["AllInteger"])
2774 def test_argpartition_empty_array(self, kth_dtype):

Callers

nothing calls this directly

Calls 3

assert_equalFunction · 0.90
partitionMethod · 0.45
ravelMethod · 0.45

Tested by

no test coverage detected