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

Function test_Array

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

Source from the content-addressed store, hash-verified

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