()
| 1378 | |
| 1379 | |
| 1380 | def test_broadcast_to_chunks(): |
| 1381 | x = np.random.default_rng().integers(10, size=(5, 1, 6)) |
| 1382 | a = from_array(x, chunks=(3, 1, 3)) |
| 1383 | |
| 1384 | for shape, chunks, expected_chunks in [ |
| 1385 | ((5, 3, 6), (3, -1, 3), ((3, 2), (3,), (3, 3))), |
| 1386 | ((5, 3, 6), (3, 1, 3), ((3, 2), (1, 1, 1), (3, 3))), |
| 1387 | ((2, 5, 3, 6), (1, 3, 1, 3), ((1, 1), (3, 2), (1, 1, 1), (3, 3))), |
| 1388 | ]: |
| 1389 | xb = np.broadcast_to(x, shape) |
| 1390 | ab = broadcast_to(a, shape, chunks=chunks) |
| 1391 | assert_eq(xb, ab) |
| 1392 | assert ab.chunks == expected_chunks |
| 1393 | |
| 1394 | with pytest.raises(ValueError): |
| 1395 | broadcast_to(a, a.shape, chunks=((2, 3), (1,), (3, 3))) |
| 1396 | with pytest.raises(ValueError): |
| 1397 | broadcast_to(a, a.shape, chunks=((3, 2), (3,), (3, 3))) |
| 1398 | with pytest.raises(ValueError): |
| 1399 | broadcast_to(a, (5, 2, 6), chunks=((3, 2), (3,), (3, 3))) |
| 1400 | |
| 1401 | |
| 1402 | def test_broadcast_arrays(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…