MCPcopy Index your code
hub / github.com/dask/dask / test_normalize_chunks

Function test_normalize_chunks

dask/array/tests/test_array_core.py:3247–3269  ·  view source on GitHub ↗
(func)

Source from the content-addressed store, hash-verified

3245
3246@pytest.mark.parametrize("func", [normalize_chunks, normalize_chunks_cached])
3247def test_normalize_chunks(func):
3248 assert func(3, (4, 6)) == ((3, 1), (3, 3))
3249 assert func(((3, 3), (8,)), (6, 8)) == ((3, 3), (8,))
3250 assert func((4, 5), (9,)) == ((4, 5),)
3251 assert func((4, 5), (9, 9)) == ((4, 4, 1), (5, 4))
3252 assert func(-1, (5, 5)) == ((5,), (5,))
3253 assert func((3, -1), (5, 5)) == ((3, 2), (5,))
3254 assert func((3, None), (5, 5)) == ((3, 2), (5,))
3255 if func is normalize_chunks:
3256 assert func({0: 3}, (5, 5)) == ((3, 2), (5,))
3257 assert func([[2, 2], [3, 3]]) == ((2, 2), (3, 3))
3258 assert func(10, (30, 5)) == ((10, 10, 10), (5,))
3259 assert func((), (0, 0)) == ((0,), (0,))
3260 assert func(-1, (0, 3)) == ((0,), (3,))
3261 assert func(((float("nan"),),)) == ((np.nan,),)
3262
3263 assert func("auto", shape=(20,), limit=5, dtype="uint8") == ((5, 5, 5, 5),)
3264 assert func(("auto", None), (5, 5), dtype=int) == ((5,), (5,))
3265
3266 with pytest.raises(ValueError):
3267 func(((10,),), (11,))
3268 with pytest.raises(ValueError):
3269 func(((5,), (5,)), (5,))
3270
3271
3272def test_single_element_tuple():

Callers

nothing calls this directly

Calls 1

funcFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…