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

Function test_export_import_device_batch

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

Source from the content-addressed store, hash-verified

393
394@needs_cffi
395def test_export_import_device_batch():
396 check_export_import_batch(
397 "ArrowDeviceArray",
398 pa.RecordBatch._export_to_c_device,
399 pa.RecordBatch._import_from_c_device,
400 make_batch,
401 )
402
403 # verify exported struct
404 c_array = ffi.new("struct ArrowDeviceArray*")
405 ptr_array = int(ffi.cast("uintptr_t", c_array))
406 batch = make_batch()
407 batch._export_to_c_device(ptr_array)
408 assert c_array.device_type == 1 # ARROW_DEVICE_CPU 1
409 assert c_array.device_id == -1
410 assert c_array.array.length == 2
411
412
413def _export_import_batch_reader(ptr_stream, reader_factory):

Callers

nothing calls this directly

Calls 4

make_batchFunction · 0.85
newMethod · 0.45
castMethod · 0.45

Tested by

no test coverage detected