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

Function test_list

python/pyarrow/tests/test_scalars.py:610–628  ·  view source on GitHub ↗
(ty, klass)

Source from the content-addressed store, hash-verified

608 (pa.large_list_view(pa.string()), pa.LargeListViewScalar)
609])
610def test_list(ty, klass):
611 v = ['foo', None]
612 s = pa.scalar(v, type=ty)
613 assert s.type == ty
614 assert len(s) == 2
615 assert isinstance(s.values, pa.Array)
616 assert s.values.to_pylist() == v
617 assert isinstance(s, klass)
618 assert repr(v) in repr(s)
619 assert s.as_py() == v
620 assert s[0].as_py() == 'foo'
621 assert s[1].as_py() is None
622 assert s[-1] == s[1]
623 assert s[-2] == s[0]
624 with pytest.raises(IndexError):
625 s[-3]
626 with pytest.raises(IndexError):
627 s[2]
628 assert isinstance(s, Sequence)
629
630
631@pytest.mark.numpy

Callers

nothing calls this directly

Calls 3

lenFunction · 0.85
as_pyMethod · 0.80
scalarMethod · 0.45

Tested by

no test coverage detected