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

Method test_shuffle_masked

numpy/random/tests/test_random.py:513–525  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

511 assert_array_equal(actual, desired)
512
513 def test_shuffle_masked(self):
514 # gh-3263
515 a = np.ma.masked_values(np.reshape(range(20), (5, 4)) % 3 - 1, -1)
516 b = np.ma.masked_values(np.arange(20) % 3 - 1, -1)
517 a_orig = a.copy()
518 b_orig = b.copy()
519 for i in range(50):
520 np.random.shuffle(a)
521 assert_equal(
522 sorted(a.data[~a.mask]), sorted(a_orig.data[~a_orig.mask]))
523 np.random.shuffle(b)
524 assert_equal(
525 sorted(b.data[~b.mask]), sorted(b_orig.data[~b_orig.mask]))
526
527 @pytest.mark.parametrize("random",
528 [np.random, np.random.RandomState(), np.random.default_rng()])

Callers

nothing calls this directly

Calls 3

assert_equalFunction · 0.90
reshapeMethod · 0.80
copyMethod · 0.45

Tested by

no test coverage detected