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

Function test_list_value_lengths

python/pyarrow/tests/test_array.py:3373–3396  ·  view source on GitHub ↗
(offset_type, list_type)

Source from the content-addressed store, hash-verified

3371 (pa.int32(), pa.list_view(pa.int32())),
3372 (pa.int64(), pa.large_list_view(pa.int32()))])
3373def test_list_value_lengths(offset_type, list_type):
3374
3375 # FixedSizeListArray needs fixed list sizes
3376 if getattr(list_type, "list_size", None):
3377 arr = pa.array(
3378 [
3379 [0, 1],
3380 None,
3381 [None, None],
3382 [3, 4]
3383 ], type=list_type)
3384 expected = pa.array([2, None, 2, 2], type=offset_type)
3385
3386 # Otherwise create variable list sizes
3387 else:
3388 arr = pa.array(
3389 [
3390 [0, 1, 2],
3391 None,
3392 [],
3393 [3, 4]
3394 ], type=list_type)
3395 expected = pa.array([3, None, 0, 2], type=offset_type)
3396 assert arr.value_lengths().equals(expected)
3397
3398
3399@pytest.mark.parametrize('list_type_factory', [pa.list_, pa.large_list])

Callers

nothing calls this directly

Calls 2

equalsMethod · 0.80
arrayMethod · 0.45

Tested by

no test coverage detected