File: test_3727_to_indexedoptionarray64_with_int32_index.py

package info (click to toggle)
python-awkward 2.9.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 25,524 kB
  • sloc: python: 187,940; cpp: 33,928; sh: 432; makefile: 21; javascript: 8
file content (18 lines) | stat: -rw-r--r-- 554 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward/blob/main/LICENSE

from __future__ import annotations

import numpy as np

import awkward as ak


def test():
    index32 = ak.index.Index(np.array([0, 1, -1], dtype=np.int32))
    content = ak.contents.NumpyArray(np.array([10, 20, 30]))
    arr = ak.contents.IndexedOptionArray(index32, content)
    new_arr = arr.to_IndexedOptionArray64()

    assert arr.index.dtype == np.dtype("int32")
    assert new_arr.index.dtype == np.dtype("int64")
    assert arr.to_list() == new_arr.to_list()