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

Function test_normalize_chunks

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

Source from the content-addressed store, hash-verified

3235
3236@pytest.mark.parametrize("func", [normalize_chunks, normalize_chunks_cached])
3237def test_normalize_chunks(func):
3238 assert func(3, (4, 6)) == ((3, 1), (3, 3))
3239 assert func(((3, 3), (8,)), (6, 8)) == ((3, 3), (8,))
3240 assert func((4, 5), (9,)) == ((4, 5),)
3241 assert func((4, 5), (9, 9)) == ((4, 4, 1), (5, 4))
3242 assert func(-1, (5, 5)) == ((5,), (5,))
3243 assert func((3, -1), (5, 5)) == ((3, 2), (5,))
3244 assert func((3, None), (5, 5)) == ((3, 2), (5,))
3245 if func is normalize_chunks:
3246 assert func({0: 3}, (5, 5)) == ((3, 2), (5,))
3247 assert func([[2, 2], [3, 3]]) == ((2, 2), (3, 3))
3248 assert func(10, (30, 5)) == ((10, 10, 10), (5,))
3249 assert func((), (0, 0)) == ((0,), (0,))
3250 assert func(-1, (0, 3)) == ((0,), (3,))
3251 assert func(((float("nan"),),)) == ((np.nan,),)
3252
3253 assert func("auto", shape=(20,), limit=5, dtype="uint8") == ((5, 5, 5, 5),)
3254 assert func(("auto", None), (5, 5), dtype=int) == ((5,), (5,))
3255
3256 with pytest.raises(ValueError):
3257 func(((10,),), (11,))
3258 with pytest.raises(ValueError):
3259 func(((5,), (5,)), (5,))
3260
3261
3262def test_single_element_tuple():

Callers

nothing calls this directly

Calls 1

funcFunction · 0.70

Tested by

no test coverage detected