Test that compute() never returns an object that shares a buffer with the dask graph or a process-local Worker
(chunks)
| 559 | |
| 560 | @pytest.mark.parametrize("chunks", [5, 10]) |
| 561 | def test_compute_copy(chunks): |
| 562 | """Test that compute() never returns an object that shares |
| 563 | a buffer with the dask graph or a process-local Worker |
| 564 | """ |
| 565 | x = da.asarray(np.arange(10), chunks=chunks) |
| 566 | |
| 567 | nx = x.compute() |
| 568 | nx[0] = 42 |
| 569 | # Did not write back to the buffer held in the Dask graph |
| 570 | assert x[0].compute() == 0 |
| 571 | |
| 572 | (nx,) = dask.compute(x) |
| 573 | nx[0] = 42 |
| 574 | assert x[0].compute() == 0 |
| 575 | |
| 576 | |
| 577 | def test_Array_numpy_gufunc_call__array_ufunc__01(): |