File: test_3347_weakref_mask_highlevel_array.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 (19 lines) | stat: -rw-r--r-- 446 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from __future__ import annotations

import pytest

import awkward as ak


def test_Array_mask_weakref():
    arr = ak.Array([1])
    m = arr.mask

    assert ak.all(m[[True]] == arr)

    del arr
    with pytest.raises(
        ValueError,
        match=r"The array to mask was deleted before it could be masked. If you want to construct this mask, you must either keep the array alive or use 'ak.mask' explicitly.",
    ):
        _ = m[[True]]