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

Function test_numpy_view

deps/pybind11/tests/test_numpy_array.py:245–275  ·  view source on GitHub ↗
(capture)

Source from the content-addressed store, hash-verified

243
244
245def test_numpy_view(capture):
246 with capture:
247 ac = m.ArrayClass()
248 ac_view_1 = ac.numpy_view()
249 ac_view_2 = ac.numpy_view()
250 assert np.all(ac_view_1 == np.array([1, 2], dtype=np.int32))
251 del ac
252 pytest.gc_collect()
253 assert (
254 capture
255 == """
256 ArrayClass()
257 ArrayClass::numpy_view()
258 ArrayClass::numpy_view()
259 """
260 )
261 ac_view_1[0] = 4
262 ac_view_1[1] = 3
263 assert ac_view_2[0] == 4
264 assert ac_view_2[1] == 3
265 with capture:
266 del ac_view_1
267 del ac_view_2
268 pytest.gc_collect()
269 pytest.gc_collect()
270 assert (
271 capture
272 == """
273 ~ArrayClass()
274 """
275 )
276
277
278def test_cast_numpy_int64_to_uint64():

Callers

nothing calls this directly

Calls 2

ArrayClassMethod · 0.80
arrayMethod · 0.45

Tested by

no test coverage detected