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

Function test_sequence_bytes

python/pyarrow/tests/test_convert_builtin.py:885–899  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

883
884
885def test_sequence_bytes():
886 u1 = b'ma\xc3\xb1ana'
887
888 data = [b'foo',
889 memoryview(b'dada'),
890 memoryview(b'd-a-t-a')[::2], # non-contiguous is made contiguous
891 u1.decode('utf-8'), # unicode gets encoded,
892 bytearray(b'bar'),
893 None]
894 for ty in [None, pa.binary(), pa.large_binary(), pa.binary_view()]:
895 arr = pa.array(data, type=ty)
896 assert len(arr) == 6
897 assert arr.null_count == 1
898 assert arr.type == ty or pa.binary()
899 assert arr.to_pylist() == [b'foo', b'dada', b'data', u1, b'bar', None]
900
901
902@pytest.mark.parametrize("ty", [pa.string(), pa.large_string(), pa.string_view()])

Callers

nothing calls this directly

Calls 3

lenFunction · 0.85
decodeMethod · 0.45
arrayMethod · 0.45

Tested by

no test coverage detected