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

Function test_map_from_tuples

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

Source from the content-addressed store, hash-verified

2145
2146
2147def test_map_from_tuples():
2148 expected = [[(b'a', 1), (b'b', 2)],
2149 [(b'c', 3)],
2150 [(b'd', 4), (b'e', 5), (b'f', None)],
2151 [(b'g', 7)]]
2152
2153 arr = pa.array(expected, type=pa.map_(pa.binary(), pa.int32()))
2154
2155 assert arr.to_pylist() == expected
2156
2157 # With omitted values
2158 expected[1] = None
2159
2160 arr = pa.array(expected, type=pa.map_(pa.binary(), pa.int32()))
2161
2162 assert arr.to_pylist() == expected
2163
2164 # Invalid tuple size
2165 for entry in [[(5,)], [()], [('5', 'foo', True)]]:
2166 with pytest.raises(ValueError, match="(?i)tuple size"):
2167 pa.array([entry], type=pa.map_('i4', 'i4'))
2168
2169
2170def test_dictionary_from_boolean():

Callers

nothing calls this directly

Calls 1

arrayMethod · 0.45

Tested by

no test coverage detected