Skip to content

Commit 40b9058

Browse files
oxinaboxgithub-actions[bot]mcabbott
authored
Allow unzip to return JLArray (#759)
* Allow unzip to return JLArray * style * style Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * extend comment Co-authored-by: Michael Abbott <32575566+mcabbott@users.noreply.github.com> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Michael Abbott <32575566+mcabbott@users.noreply.github.com>
1 parent 87f4996 commit 40b9058

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

test/unzipped.jl

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,14 @@ using ChainRules: unzip_broadcast, unzip #, unzip_map
8787
# TODO invent some tests of this rrule's pullback function
8888

8989
@test unzip(jl([(1,2), (3,4), (5,6)])) == (jl([1, 3, 5]), jl([2, 4, 6]))
90-
9190
@test unzip(jl([(missing,2), (missing,4), (missing,6)]))[2] == jl([2, 4, 6])
92-
@test unzip(jl([(missing,2), (missing,4), (missing,6)]))[2] isa Base.ReinterpretArray
93-
9491
@test unzip(jl([(1,), (3,), (5,)]))[1] == jl([1, 3, 5])
95-
@test unzip(jl([(1,), (3,), (5,)]))[1] isa Base.ReinterpretArray
92+
93+
# depending on Julia/package versions, may get ReinterpretArray or JLArray
94+
# Either is acceptable
95+
@test isa(
96+
unzip(jl([(missing, 2), (missing, 4), (missing, 6)]))[2],
97+
Union{Base.ReinterpretArray,JLArray},
98+
)
9699
end
97-
end
100+
end

0 commit comments

Comments
 (0)