-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix:
ak.num
should always return a useful (non-unknown length) type (…
…#2785) * fix: `ak.num` should always return a useful (non-unknown length) type * test: add test * feat: always return ArrayLike for `ak.num` * test: update test to reflect ak.num behavior
- Loading branch information
Showing
2 changed files
with
19 additions
and
2 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
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,16 @@ | ||
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE | ||
|
||
|
||
import awkward as ak | ||
from awkward._nplikes.typetracer import TypeTracerArray | ||
|
||
|
||
def test_unknown_length(): | ||
array = ak.typetracer.typetracer_from_form(ak.forms.NumpyForm("int64")) | ||
assert isinstance(ak.num(array, axis=0), TypeTracerArray) | ||
|
||
|
||
def test_known_length(): | ||
array = ak.Array([0, 1, 2, 3], backend="typetracer") | ||
# This is now the new behavior - always return typetracers | ||
assert isinstance(ak.num(array, axis=0), TypeTracerArray) |