| 545 | |
| 546 | |
| 547 | def test_reshape_tuple(): |
| 548 | a = np.arange(3 * 7 * 2) + 1 |
| 549 | x = m.reshape_tuple(a, (3, 7, 2)) |
| 550 | assert x.shape == (3, 7, 2) |
| 551 | assert list(x[1][4]) == [23, 24] |
| 552 | y = m.reshape_tuple(x, (x.size,)) |
| 553 | assert y.shape == (42,) |
| 554 | with pytest.raises(ValueError) as excinfo: |
| 555 | m.reshape_tuple(a, (3, 7, 1)) |
| 556 | assert str(excinfo.value) == "cannot reshape array of size 42 into shape (3,7,1)" |
| 557 | with pytest.raises(ValueError) as excinfo: |
| 558 | m.reshape_tuple(a, ()) |
| 559 | assert str(excinfo.value) == "cannot reshape array of size 42 into shape ()" |
| 560 | |
| 561 | |
| 562 | def test_index_using_ellipsis(): |