File: test_1193_is_none_nested_option.py

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

from __future__ import annotations

import numpy as np
import pytest  # noqa: F401

import awkward as ak


def test():
    index_of_index = ak.highlevel.Array(
        ak.contents.IndexedOptionArray.simplified(
            ak.index.Index64(np.r_[0, 1, 2, -1]),
            ak.contents.IndexedOptionArray(
                ak.index.Index64(np.r_[0, -1, 2, 3]),
                ak.contents.NumpyArray(np.r_[1, 2, 3, 4]),
            ),
        )
    )

    mask = ak.operations.is_none(index_of_index)
    assert mask.to_list() == [False, True, False, True]