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

Method test_partition_fuzz

numpy/_core/tests/test_multiarray.py:3696–3707  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3694 assert_raises(ValueError, d.argpartition, 2, kind=k)
3695
3696 def test_partition_fuzz(self):
3697 # a few rounds of random data testing
3698 for j in range(10, 30):
3699 for i in range(1, j - 2):
3700 d = np.arange(j)
3701 np.random.shuffle(d)
3702 d = d % np.random.randint(2, 30)
3703 idx = np.random.randint(d.size)
3704 kth = [0, idx, i, i + 1]
3705 tgt = np.sort(d)[kth]
3706 assert_array_equal(np.partition(d, kth)[kth], tgt,
3707 err_msg=f"data: {d!r}\n kth: {kth!r}")
3708
3709 @pytest.mark.parametrize("kth_dtype", np.typecodes["AllInteger"])
3710 def test_argpartition_gh5524(self, kth_dtype):

Callers

nothing calls this directly

Calls 3

assert_array_equalFunction · 0.90
sortMethod · 0.45
partitionMethod · 0.45

Tested by

no test coverage detected