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

Function test_nbytes_auto

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

Source from the content-addressed store, hash-verified

5535
5536
5537def test_nbytes_auto():
5538 chunks = normalize_chunks("800B", shape=(500,), dtype="float64")
5539 assert chunks == ((100, 100, 100, 100, 100),)
5540 chunks = normalize_chunks("200B", shape=(10, 10), dtype="float64")
5541 assert chunks == ((5, 5), (5, 5))
5542 chunks = normalize_chunks((5, "200B"), shape=(10, 10), dtype="float64")
5543 assert chunks == ((5, 5), (5, 5))
5544 chunks = normalize_chunks("33B", shape=(10, 10), dtype="float64")
5545 assert chunks == ((2, 2, 2, 2, 2), (2, 2, 2, 2, 2))
5546 chunks = normalize_chunks("1800B", shape=(10, 20, 30), dtype="float64")
5547 assert chunks == ((6, 4), (6, 6, 6, 2), (6, 6, 6, 6, 6))
5548
5549 with pytest.raises(ValueError):
5550 normalize_chunks("10B", shape=(10,), limit=20, dtype="float64")
5551 with pytest.raises(ValueError):
5552 normalize_chunks("100B", shape=(10, 10), limit=20, dtype="float64")
5553 with pytest.raises(ValueError):
5554 normalize_chunks(("100B", "10B"), shape=(10, 10), dtype="float64")
5555 with pytest.raises(ValueError):
5556 normalize_chunks(("10B", "10B"), shape=(10, 10), limit=20, dtype="float64")
5557
5558
5559def test_auto_chunks():

Callers

nothing calls this directly

Calls 1

normalize_chunksFunction · 0.90

Tested by

no test coverage detected