MCPcopy Create free account
hub / github.com/pybind/pybind11 / test_reshape_initializer_list

Function test_reshape_initializer_list

tests/test_numpy_array.py:537–544  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

535
536
537def test_reshape_initializer_list():
538 a = np.arange(2 * 7 * 3) + 1
539 x = m.reshape_initializer_list(a, 2, 7, 3)
540 assert x.shape == (2, 7, 3)
541 assert list(x[1][4]) == [34, 35, 36]
542 with pytest.raises(ValueError) as excinfo:
543 m.reshape_initializer_list(a, 1, 7, 3)
544 assert str(excinfo.value) == "cannot reshape array of size 42 into shape (1,7,3)"
545
546
547def test_reshape_tuple():

Callers

nothing calls this directly

Calls 2

listClass · 0.85
strClass · 0.85

Tested by

no test coverage detected