Skip to content

Commit

Permalink
Merge pull request #214 from KristofferC/kc/eachslice_throw
Browse files Browse the repository at this point in the history
fix tests on 1.9 where `eachslice` with multiple dimensions are supported
  • Loading branch information
oxinabox authored Mar 3, 2023
2 parents 10a2c7e + 3f5034d commit cd36392
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
17 changes: 15 additions & 2 deletions test/functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,21 @@ using Statistics
sum(eachslice(a; dims=3)) ==
slices[1] + slices[2]
)
@test_throws ArgumentError eachslice(nda; dims=(1, 2))
@test_throws ArgumentError eachslice(a; dims=(1, 2))

supports_eachslice_multidim =
try
eachslice(a; dims=(1, 2))
true
catch
false
end

if supports_eachslice_multidim
eachslice(nda; dims=(1, 2)) == eachslice(a; dims=(1, 2))
else
@test_throws ArgumentError eachslice(nda; dims=(1, 2))
@test_throws ArgumentError eachslice(a; dims=(1, 2))
end

@test_throws UndefKeywordError eachslice(nda)
@test_throws UndefKeywordError eachslice(a)
Expand Down
1 change: 0 additions & 1 deletion test/functions_linearalgebra.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Test: approx_full
using LinearAlgebra
using NamedDims
using NamedDims: dimnames
Expand Down

0 comments on commit cd36392

Please sign in to comment.