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

Function test_list_from_buffers

python/pyarrow/tests/test_array.py:850–868  ·  view source on GitHub ↗
(list_type_factory)

Source from the content-addressed store, hash-verified

848@pytest.mark.parametrize('list_type_factory', [
849 pa.list_, pa.large_list, pa.list_view, pa.large_list_view])
850def test_list_from_buffers(list_type_factory):
851 ty = list_type_factory(pa.int16())
852 array = pa.array([[0, 1, 2], None, [], [3, 4, 5]], type=ty)
853 assert array.type == ty
854
855 buffers = array.buffers()
856
857 with pytest.raises(ValueError):
858 # No children
859 pa.Array.from_buffers(ty, 4, buffers[:ty.num_buffers])
860
861 child = pa.Array.from_buffers(pa.int16(), 6, buffers[ty.num_buffers:])
862 copied = pa.Array.from_buffers(ty, 4, buffers[:ty.num_buffers], children=[child])
863 assert copied.equals(array)
864
865 with pytest.raises(ValueError):
866 # too many children
867 pa.Array.from_buffers(ty, 4, buffers[:ty.num_buffers],
868 children=[child, child])
869
870
871def test_struct_from_buffers():

Callers

nothing calls this directly

Calls 3

buffersMethod · 0.80
equalsMethod · 0.80
arrayMethod · 0.45

Tested by

no test coverage detected