MCPcopy Create free account
hub / github.com/dask/dask / test_compute_copy

Function test_compute_copy

dask/array/tests/test_array_core.py:561–574  ·  view source on GitHub ↗

Test that compute() never returns an object that shares a buffer with the dask graph or a process-local Worker

(chunks)

Source from the content-addressed store, hash-verified

559
560@pytest.mark.parametrize("chunks", [5, 10])
561def 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
577def test_Array_numpy_gufunc_call__array_ufunc__01():

Callers

nothing calls this directly

Calls 2

arangeMethod · 0.45
computeMethod · 0.45

Tested by

no test coverage detected