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

Function test_map_duplicate_fields

python/pyarrow/tests/test_scalars.py:833–844  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

831
832
833def test_map_duplicate_fields():
834 ty = pa.map_(pa.string(), pa.int8())
835 v = [('a', 1), ('a', 2)]
836 s = pa.scalar(v, type=ty)
837
838 assert s.as_py(maps_as_pydicts=None) == v
839
840 with pytest.raises(KeyError):
841 assert s.as_py(maps_as_pydicts="strict")
842
843 with pytest.warns(match="Encountered key 'a' which was already encountered"):
844 assert s.as_py(maps_as_pydicts="lossy") == {'a': 2}
845
846
847def test_dictionary(pickle_module):

Callers

nothing calls this directly

Calls 3

as_pyMethod · 0.80
stringMethod · 0.45
scalarMethod · 0.45

Tested by

no test coverage detected