| 1083 | |
| 1084 | @pytest.mark.numpy |
| 1085 | def test_dictionary_from_boxed_arrays(): |
| 1086 | indices = np.repeat([0, 1, 2], 2) |
| 1087 | dictionary = np.array(['foo', 'bar', 'baz'], dtype=object) |
| 1088 | |
| 1089 | iarr = pa.array(indices) |
| 1090 | darr = pa.array(dictionary) |
| 1091 | |
| 1092 | d1 = pa.DictionaryArray.from_arrays(iarr, darr) |
| 1093 | |
| 1094 | assert d1.indices.to_pylist() == indices.tolist() |
| 1095 | assert d1.dictionary.to_pylist() == dictionary.tolist() |
| 1096 | |
| 1097 | for i in range(len(indices)): |
| 1098 | assert d1[i].as_py() == dictionary[indices[i]] |
| 1099 | |
| 1100 | |
| 1101 | def test_dictionary_from_arrays_boundscheck(): |