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

Function test_dictionary_from_arrays_boundscheck

python/pyarrow/tests/test_array.py:1101–1119  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1099
1100
1101def test_dictionary_from_arrays_boundscheck():
1102 indices1 = pa.array([0, 1, 2, 0, 1, 2])
1103 indices2 = pa.array([0, -1, 2])
1104 indices3 = pa.array([0, 1, 2, 3])
1105
1106 dictionary = pa.array(['foo', 'bar', 'baz'])
1107
1108 # Works fine
1109 pa.DictionaryArray.from_arrays(indices1, dictionary)
1110
1111 with pytest.raises(pa.ArrowException):
1112 pa.DictionaryArray.from_arrays(indices2, dictionary)
1113
1114 with pytest.raises(pa.ArrowException):
1115 pa.DictionaryArray.from_arrays(indices3, dictionary)
1116
1117 # If we are confident that the indices are "safe" we can pass safe=False to
1118 # disable the boundschecking
1119 pa.DictionaryArray.from_arrays(indices2, dictionary, safe=False)
1120
1121
1122def test_dictionary_indices():

Callers

nothing calls this directly

Calls 1

arrayMethod · 0.45

Tested by

no test coverage detected