MCPcopy
hub / github.com/dask/dask / test_nbytes_auto

Function test_nbytes_auto

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

Source from the content-addressed store, hash-verified

5721
5722
5723def test_nbytes_auto():
5724 chunks = normalize_chunks("800B", shape=(500,), dtype="float64")
5725 assert chunks == ((100, 100, 100, 100, 100),)
5726 chunks = normalize_chunks("200B", shape=(10, 10), dtype="float64")
5727 assert chunks == ((5, 5), (5, 5))
5728 chunks = normalize_chunks((5, "200B"), shape=(10, 10), dtype="float64")
5729 assert chunks == ((5, 5), (5, 5))
5730 chunks = normalize_chunks("33B", shape=(10, 10), dtype="float64")
5731 assert chunks == ((2, 2, 2, 2, 2), (2, 2, 2, 2, 2))
5732 chunks = normalize_chunks("1800B", shape=(10, 20, 30), dtype="float64")
5733 assert chunks == ((6, 4), (6, 6, 6, 2), (6, 6, 6, 6, 6))
5734
5735 with pytest.raises(ValueError):
5736 normalize_chunks("10B", shape=(10,), limit=20, dtype="float64")
5737 with pytest.raises(ValueError):
5738 normalize_chunks("100B", shape=(10, 10), limit=20, dtype="float64")
5739 with pytest.raises(ValueError):
5740 normalize_chunks(("100B", "10B"), shape=(10, 10), dtype="float64")
5741 with pytest.raises(ValueError):
5742 normalize_chunks(("10B", "10B"), shape=(10, 10), limit=20, dtype="float64")
5743
5744
5745def test_auto_chunks():

Callers

nothing calls this directly

Calls 1

normalize_chunksFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…