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

Function test_dictionary_array_index_width_adapts

python/pyarrow/tests/test_array.py:4734–4740  ·  view source on GitHub ↗
(start_type, widened_type)

Source from the content-addressed store, hash-verified

4732@pytest.mark.parametrize("start_type, widened_type", [(pa.int8(), pa.int16()),
4733 (pa.uint8(), pa.uint16())])
4734def test_dictionary_array_index_width_adapts(start_type, widened_type):
4735 # The index width adapts to the number of distinct values, as it does for signed
4736 # indices; only the signedness of the requested type is preserved.
4737 values = [str(i) for i in range(200)]
4738 arr = pa.array(values, type=pa.dictionary(start_type, pa.string()))
4739 assert arr.type == pa.dictionary(widened_type, pa.string())
4740 assert arr.to_pylist() == values
4741
4742
4743@pytest.mark.pandas

Callers

nothing calls this directly

Calls 3

arrayMethod · 0.45
dictionaryMethod · 0.45
stringMethod · 0.45

Tested by

no test coverage detected