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

Function test_string_view_from_buffers

python/pyarrow/tests/test_array.py:822–845  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

820
821
822def test_string_view_from_buffers():
823 array = pa.array(
824 [
825 "String longer than 12 characters",
826 None,
827 "short",
828 "Length is 12"
829 ], type=pa.string_view())
830
831 buffers = array.buffers()
832 copied = pa.StringViewArray.from_buffers(
833 pa.string_view(), len(array), buffers)
834 copied.validate(full=True)
835 assert copied.to_pylist() == [
836 "String longer than 12 characters",
837 None,
838 "short",
839 "Length is 12"
840 ]
841
842 match = r"number of buffers is at least 2"
843 with pytest.raises(ValueError, match=match):
844 pa.StringViewArray.from_buffers(
845 pa.string_view(), len(array), buffers[0:1])
846
847
848@pytest.mark.parametrize('list_type_factory', [

Callers

nothing calls this directly

Calls 4

lenFunction · 0.85
buffersMethod · 0.80
arrayMethod · 0.45
validateMethod · 0.45

Tested by

no test coverage detected