Skip to content

Commit

Permalink
feat: raise ValueError for mixed indices
Browse files Browse the repository at this point in the history
This changes #1305
  • Loading branch information
agoose77 committed Aug 26, 2022
1 parent 3dac427 commit 458b1d8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/awkward/_v2/_slicing.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ def getitem_broadcast(items):

if awkward_items > 1 or (awkward_items == 1 and len(broadcastable) != 0):
raise ak._v2._util.error(
TypeError(
"cannot mix Awkward slicing (using an array with missing or variable-length lists in the slice) with NumPy advanced slicing (using more than one broadcastable array or integer in the slice), though you can perform multiple slices"
ValueError(
"cannot mix Awkward slicing (using an array with missing or variable-length lists in the slice) with "
"NumPy advanced slicing (using more than one broadcastable array or integer in the slice), "
"though you can perform multiple slices "
)
)

Expand Down
2 changes: 1 addition & 1 deletion tests/v2/test_1305-mixed-awkward-numpy-slicing.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ def test():
array = ak._v2.Array([[3.14]])
first_slice = ak._v2.Array([True, None])[:1] # type is 1 * ?bool
second_slice = 0
with pytest.raises(TypeError):
with pytest.raises(ValueError):
array[first_slice, second_slice]

0 comments on commit 458b1d8

Please sign in to comment.