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

Function test_broadcast_to

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

Source from the content-addressed store, hash-verified

1341
1342
1343def test_broadcast_to():
1344 x = np.random.default_rng().integers(10, size=(5, 1, 6))
1345 a = from_array(x, chunks=(3, 1, 3))
1346
1347 for shape in [a.shape, (5, 0, 6), (5, 4, 6), (2, 5, 1, 6), (3, 4, 5, 4, 6)]:
1348 xb = np.broadcast_to(x, shape)
1349 ab = broadcast_to(a, shape)
1350
1351 assert_eq(xb, ab)
1352
1353 if a.shape == ab.shape:
1354 assert a is ab
1355
1356 pytest.raises(ValueError, lambda: broadcast_to(a, (2, 1, 6)))
1357 pytest.raises(ValueError, lambda: broadcast_to(a, (3,)))
1358
1359
1360def test_broadcast_to_array():

Callers

nothing calls this directly

Calls 4

from_arrayFunction · 0.90
broadcast_toFunction · 0.90
assert_eqFunction · 0.90
integersMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…