MCPcopy Create free account
hub / github.com/apache/arrow / test_export_import_device_array

Function test_export_import_device_array

python/pyarrow/tests/test_cffi.py:271–286  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

269
270@needs_cffi
271def test_export_import_device_array():
272 check_export_import_array(
273 "ArrowDeviceArray",
274 pa.Array._export_to_c_device,
275 pa.Array._import_from_c_device,
276 )
277
278 # verify exported struct
279 c_array = ffi.new("struct ArrowDeviceArray*")
280 ptr_array = int(ffi.cast("uintptr_t", c_array))
281 arr = pa.array([[1], [2, 42]], type=pa.list_(pa.int32()))
282 arr._export_to_c_device(ptr_array)
283
284 assert c_array.device_type == 1 # ARROW_DEVICE_CPU 1
285 assert c_array.device_id == -1
286 assert c_array.array.length == 2
287
288
289def check_export_import_schema(schema_factory, expected_schema_factory=None):

Callers

nothing calls this directly

Calls 4

newMethod · 0.45
castMethod · 0.45
arrayMethod · 0.45

Tested by

no test coverage detected