Skip to content

Commit b03ff59

Browse files
committed
Add tests for Value axistrait inheritance
1 parent 4019113 commit b03ff59

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

test/indexing.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,13 @@ acc = zeros(Int, 4, 1, 2)
193193
Base.mapreducedim!(x->x>5, +, acc, A3)
194194
@test acc == reshape([1 3; 2 3; 2 3; 2 3], 4, 1, 2)
195195

196+
# Value axistraits
197+
@testset for typ in (IL.IntLike, Complex{Float32}, DateTime, String, Symbol, Int)
198+
@test AxisArrays.axistrait(Axis{:foo, Vector{AxisArrays.ExactValue{typ}}}) ===
199+
AxisArrays.axistrait(Axis{:foo, Vector{AxisArrays.TolValue{typ}}}) ===
200+
AxisArrays.axistrait(Axis{:bar, Vector{typ}})
201+
end
202+
196203
# Indexing by value using `atvalue`
197204
A = AxisArray([1 2; 3 4], Axis{:x}([1.0,4.0]), Axis{:y}([2.0,6.1]))
198205
@test @inferred(A[atvalue(1.0)]) == @inferred(A[atvalue(1.0), :]) == [1,2]

0 commit comments

Comments
 (0)