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

Function test_Array

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

Source from the content-addressed store, hash-verified

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