MCPcopy
hub / github.com/dask/dask / test_Array

Function test_Array

dask/array/tests/test_array_core.py:384–405  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

382
383
384def test_Array():
385 arr = object() # arraylike is unimportant since we never compute
386 shape = (1000, 1000)
387 chunks = (100, 100)
388 name = "x"
389 dsk = graph_from_arraylike(arr, chunks, shape, name)
390 a = Array(dsk, name, chunks, shape=shape, dtype="f8")
391
392 assert a.numblocks == (10, 10)
393
394 assert a.__dask_keys__() == [[("x", i, j) for j in range(10)] for i in range(10)]
395
396 assert a.chunks == ((100,) * 10, (100,) * 10)
397
398 assert a.shape == shape
399
400 assert len(a) == shape[0]
401
402 with pytest.raises(ValueError):
403 Array(dsk, name, chunks, shape=shape)
404 with pytest.raises(TypeError):
405 Array(dsk, name, chunks, shape=shape, dtype="f8", meta=np.empty(0, 0))
406
407
408def test_uneven_chunks():

Callers

nothing calls this directly

Calls 4

__dask_keys__Method · 0.95
graph_from_arraylikeFunction · 0.90
ArrayClass · 0.90
emptyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…