-
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.
Merge branch 'main' into agoose77/feat-extend-to-layout-options
- Loading branch information
Showing
5 changed files
with
74 additions
and
12 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
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
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,51 @@ | ||
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE | ||
|
||
import pytest # noqa: F401 | ||
|
||
import awkward as ak | ||
|
||
|
||
def test_all_none(): | ||
result = ak.argsort([None, None, None]) | ||
assert ak.is_valid(result) | ||
assert result.to_list() == [0, 1, 2] | ||
assert isinstance(result.layout, ak.contents.NumpyArray) | ||
assert result.type == ak.types.ArrayType(ak.types.NumpyType("int64"), 3) | ||
|
||
|
||
def test_mixed_none_local(): | ||
result = ak.argsort([None, 1, None, 2, 0, None, -1]) | ||
assert ak.is_valid(result) | ||
assert result.to_list() == [6, 4, 1, 3, 0, 2, 5] | ||
assert result.type == ak.types.ArrayType(ak.types.NumpyType("int64"), 7) | ||
|
||
|
||
def test_mixed_none_2d_local(): | ||
result = ak.argsort( | ||
[ | ||
[None, 1, None, 0, None, None, -1], | ||
None, | ||
[None, 2, None, 2, 0, None, -2], | ||
], | ||
axis=1, | ||
) | ||
assert ak.is_valid(result) | ||
assert result.to_list() == [[6, 3, 1, 0, 2, 4, 5], None, [6, 4, 1, 3, 0, 2, 5]] | ||
assert result.type == ak.types.ArrayType( | ||
ak.types.OptionType(ak.types.ListType(ak.types.NumpyType("int64"))), 3 | ||
) | ||
|
||
|
||
def test_mixed_none_2d_nonlocal(): | ||
result = ak.argsort( | ||
[ | ||
[None, 1, None, 0, None, None, -1], | ||
[None, 2, None, 2, 0, None, -2], | ||
], | ||
axis=0, | ||
) | ||
assert ak.is_valid(result) | ||
assert result.to_list() == [[0, 0, 0, 0, 1, 0, 1], [1, 1, 1, 1, 0, 1, 0]] | ||
assert result.type == ak.types.ArrayType( | ||
ak.types.ListType(ak.types.NumpyType("int64")), 2 | ||
) |