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

Function test_array_view

tests/test_numpy_array.py:522–528  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

520
521
522def test_array_view():
523 a = np.ones(100 * 4).astype("uint8")
524 a_float_view = m.array_view(a, "float32")
525 assert a_float_view.shape == (100 * 1,) # 1 / 4 bytes = 8 / 32
526
527 a_int16_view = m.array_view(a, "int16") # 1 / 2 bytes = 16 / 32
528 assert a_int16_view.shape == (100 * 2,)
529
530
531def test_array_view_invalid():

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected