(generator_class)
| 389 | |
| 390 | |
| 391 | def 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 | |
| 418 | def test_auto_chunks(generator_class): |
nothing calls this directly
no test coverage detected
searching dependent graphs…