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

Function test_sequence_bytes

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

Source from the content-addressed store, hash-verified

860
861
862def test_sequence_bytes():
863 u1 = b'ma\xc3\xb1ana'
864
865 data = [b'foo',
866 memoryview(b'dada'),
867 memoryview(b'd-a-t-a')[::2], # non-contiguous is made contiguous
868 u1.decode('utf-8'), # unicode gets encoded,
869 bytearray(b'bar'),
870 None]
871 for ty in [None, pa.binary(), pa.large_binary(), pa.binary_view()]:
872 arr = pa.array(data, type=ty)
873 assert len(arr) == 6
874 assert arr.null_count == 1
875 assert arr.type == ty or pa.binary()
876 assert arr.to_pylist() == [b'foo', b'dada', b'data', u1, b'bar', None]
877
878
879@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