-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ak.typetracer.length_one_if_typetracer with option and union typ…
…es (#3266) * fix: ak.typetracer.length_one_if_typetracer with option and union types * forgot to add the test * style: pre-commit fixes * no, not the Emacs backup file --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
d7264c1
commit 88ba3e5
Showing
2 changed files
with
69 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
tests/test_3264_length_one_if_typetracer_with_option_types.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward/blob/main/LICENSE | ||
# ruff: noqa: E402 | ||
|
||
from __future__ import annotations | ||
|
||
import awkward as ak | ||
|
||
|
||
def test(): | ||
arr = ak.Array([[1], [2, 3], [1, 2, 4, 5]])[[0, None, 2]] | ||
l1 = ak.typetracer.length_one_if_typetracer(ak.to_backend(arr, "typetracer")) | ||
|
||
assert l1.to_list() == [None] | ||
assert str(l1.type) == "1 * option[var * int64]" |