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

Function test_chunked_array_c_array_interface

python/pyarrow/tests/test_table.py:502–520  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

500
501
502def test_chunked_array_c_array_interface():
503 class ArrayWrapper:
504 def __init__(self, array):
505 self.array = array
506
507 def __arrow_c_array__(self, requested_schema=None):
508 return self.array.__arrow_c_array__(requested_schema)
509
510 data = pa.array([1, 2, 3], pa.int64())
511 chunked = pa.chunked_array([data])
512 wrapper = ArrayWrapper(data)
513
514 # Can roundtrip through the wrapper.
515 result = pa.chunked_array(wrapper)
516 assert result == chunked
517
518 # Can also import with a type that implementer can cast to.
519 result = pa.chunked_array(wrapper, type=pa.int16())
520 assert result == chunked.cast(pa.int16())
521
522
523def test_chunked_array_c_stream_interface():

Callers

nothing calls this directly

Calls 4

chunked_arrayMethod · 0.80
ArrayWrapperClass · 0.70
arrayMethod · 0.45
castMethod · 0.45

Tested by

no test coverage detected