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

Function test_map_blocks3

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

Source from the content-addressed store, hash-verified

3216
3217
3218def test_map_blocks3():
3219 x = np.arange(10)
3220 y = np.arange(10) * 2
3221
3222 d = da.from_array(x, chunks=5)
3223 e = da.from_array(y, chunks=5)
3224
3225 assert_eq(
3226 da.core.map_blocks(lambda a, b: a + 2 * b, d, e, dtype=d.dtype), x + 2 * y
3227 )
3228
3229 z = np.arange(100).reshape((10, 10))
3230 f = da.from_array(z, chunks=5)
3231
3232 func = lambda a, b: a + 2 * b
3233 res = da.core.map_blocks(func, d, f, dtype=d.dtype)
3234 assert_eq(res, x + 2 * z)
3235 assert same_keys(da.core.map_blocks(func, d, f, dtype=d.dtype), res)
3236
3237 assert_eq(da.map_blocks(func, f, d, dtype=d.dtype), z + 2 * x)
3238
3239
3240def test_from_array_with_missing_chunks():

Callers

nothing calls this directly

Calls 5

assert_eqFunction · 0.90
same_keysFunction · 0.90
reshapeMethod · 0.80
arangeMethod · 0.45
map_blocksMethod · 0.45

Tested by

no test coverage detected