MCPcopy
hub / github.com/dask/dask / test_permutation

Function test_permutation

dask/array/tests/test_random.py:391–415  ·  view source on GitHub ↗
(generator_class)

Source from the content-addressed store, hash-verified

389
390
391def test_permutation(generator_class):
392 x = da.arange(12, chunks=3)
393 y = generator_class().permutation(x)
394
395 assert y.shape == x.shape
396 assert y.dtype == x.dtype
397
398 y.compute() # smoke test
399
400 a = generator_class(0)
401 b = generator_class(0)
402 r1 = a.permutation(x)
403 r2 = b.permutation(x)
404 assert_eq(r1, r2)
405
406 # Ensure subsequent `permutation` calls return a different result
407 # See https://github.com/dask/dask/issues/12029
408 r3 = a.permutation(x)
409 r4 = b.permutation(x)
410 assert_eq(r3, r4)
411 with pytest.raises(AssertionError):
412 assert_eq(r1, r3)
413
414 x = generator_class().permutation(100)
415 assert x.shape == (100,)
416
417
418def test_auto_chunks(generator_class):

Callers

nothing calls this directly

Calls 5

assert_eqFunction · 0.90
generator_classFunction · 0.85
arangeMethod · 0.45
permutationMethod · 0.45
computeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…