()
| 269 | |
| 270 | @needs_cffi |
| 271 | def 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 | |
| 289 | def check_export_import_schema(schema_factory, expected_schema_factory=None): |
nothing calls this directly
no test coverage detected