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:428–443  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

426
427@needs_cffi
428def test_export_import_device_batch():
429 check_export_import_batch(
430 "ArrowDeviceArray",
431 pa.RecordBatch._export_to_c_device,
432 pa.RecordBatch._import_from_c_device,
433 make_batch,
434 )
435
436 # verify exported struct
437 c_array = ffi.new("struct ArrowDeviceArray*")
438 ptr_array = int(ffi.cast("uintptr_t", c_array))
439 batch = make_batch()
440 batch._export_to_c_device(ptr_array)
441 assert c_array.device_type == 1 # ARROW_DEVICE_CPU 1
442 assert c_array.device_id == -1
443 assert c_array.array.length == 2
444
445
446def _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