1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward/blob/main/LICENSE
from __future__ import annotations
import numpy as np # noqa: F401
import pytest
import awkward as ak
import awkward._connect.cling
import awkward._lookup
def test():
array = ak.Array([[0, 1, 2, 3], [8, 9, 10, 11]])
with pytest.raises(ValueError, match=r"one-dimensional"):
ak.unflatten(array, [[4, 2, 2]], axis=-1)
with pytest.raises(ValueError, match=r"negative counts"):
ak.unflatten(array, -40, axis=-1)
with pytest.raises(ValueError, match=r"does not fit"):
ak.unflatten(array, [-40], axis=-1)
with pytest.raises(ValueError, match=r"must be integers"):
ak.unflatten(array, [4.0, 2.0, 2.0], axis=-1)
with pytest.raises(ValueError, match=r"too large"):
ak.unflatten(array, 100, axis=-1)
with pytest.raises(ValueError, match=r"does not fit"):
ak.unflatten(array, [100], axis=-1)
|