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

Function test_bounds_check

tests/test_numpy_array.py:195–211  ·  view source on GitHub ↗
(arr)

Source from the content-addressed store, hash-verified

193
194
195def test_bounds_check(arr):
196 for func in (
197 m.index_at,
198 m.index_at_t,
199 m.data,
200 m.data_t,
201 m.mutate_data,
202 m.mutate_data_t,
203 m.at_t,
204 m.mutate_at_t,
205 ):
206 with pytest.raises(IndexError) as excinfo:
207 func(arr, 2, 0)
208 assert str(excinfo.value) == "index 2 is out of bounds for axis 0 with size 2"
209 with pytest.raises(IndexError) as excinfo:
210 func(arr, 0, 4)
211 assert str(excinfo.value) == "index 4 is out of bounds for axis 1 with size 3"
212
213
214def test_make_c_f_array():

Callers

nothing calls this directly

Calls 2

strClass · 0.85
funcFunction · 0.70

Tested by

no test coverage detected