MCPcopy Create free account
hub / github.com/apple/coremltools / test_bounds_check

Function test_bounds_check

deps/pybind11/tests/test_numpy_array.py:156–172  ·  view source on GitHub ↗
(arr)

Source from the content-addressed store, hash-verified

154
155
156def test_bounds_check(arr):
157 for func in (
158 m.index_at,
159 m.index_at_t,
160 m.data,
161 m.data_t,
162 m.mutate_data,
163 m.mutate_data_t,
164 m.at_t,
165 m.mutate_at_t,
166 ):
167 with pytest.raises(IndexError) as excinfo:
168 func(arr, 2, 0)
169 assert str(excinfo.value) == "index 2 is out of bounds for axis 0 with size 2"
170 with pytest.raises(IndexError) as excinfo:
171 func(arr, 0, 4)
172 assert str(excinfo.value) == "index 4 is out of bounds for axis 1 with size 3"
173
174
175def test_make_c_f_array():

Callers

nothing calls this directly

Calls 2

funcFunction · 0.70
strClass · 0.50

Tested by

no test coverage detected