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

Function test_make_struct

python/pyarrow/tests/test_compute.py:3815–3831  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3813
3814
3815def test_make_struct():
3816 assert pc.make_struct(1, 'a').as_py() == {'0': 1, '1': 'a'}
3817
3818 assert pc.make_struct(1, 'a', field_names=['i', 's']).as_py() == {
3819 'i': 1, 's': 'a'}
3820
3821 assert pc.make_struct([1, 2, 3],
3822 "a b c".split()) == pa.StructArray.from_arrays([
3823 [1, 2, 3],
3824 "a b c".split()], names='0 1'.split())
3825
3826 with pytest.raises(ValueError,
3827 match="Array arguments must all be the same length"):
3828 pc.make_struct([1, 2, 3, 4], "a b c".split())
3829
3830 with pytest.raises(ValueError, match="0 arguments but 2 field names"):
3831 pc.make_struct(field_names=['one', 'two'])
3832
3833
3834def test_map_lookup():

Callers

nothing calls this directly

Calls 1

as_pyMethod · 0.80

Tested by

no test coverage detected