Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generalize exception type #707

Merged
merged 1 commit into from
Aug 21, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions test/pairwise.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ arbitrary_fun(x, y) = cor(x, y)

@inferred pairwise(f, x, y)

@test_throws ArgumentError pairwise(f, [Int[]], [Int[]])
@test_throws ArgumentError pairwise!(f, zeros(1, 1), [Int[]], [Int[]])
@test_throws Union{ArgumentError,MethodError} pairwise(f, [Int[]], [Int[]])
@test_throws Union{ArgumentError,MethodError} pairwise!(f, zeros(1, 1), [Int[]], [Int[]])

res = pairwise(f, [], [])
@test size(res) == (0, 0)
Expand Down Expand Up @@ -144,12 +144,12 @@ arbitrary_fun(x, y) = cor(x, y)
@test res ≅ res2 ≅ [f(xi, yi) for xi in xm, yi in ym]

if VERSION >= v"1.5" # Fails with UndefVarError on Julia 1.0
@test_throws ArgumentError pairwise(f, xm, ym, skipmissing=:pairwise)
@test_throws ArgumentError pairwise(f, xm, ym, skipmissing=:listwise)
@test_throws Union{ArgumentError,MethodError} pairwise(f, xm, ym, skipmissing=:pairwise)
@test_throws Union{ArgumentError,MethodError} pairwise(f, xm, ym, skipmissing=:listwise)

res = zeros(Union{Float64, Missing}, length(xm), length(ym))
@test_throws ArgumentError pairwise!(f, res, xm, ym, skipmissing=:pairwise)
@test_throws ArgumentError pairwise!(f, res, xm, ym, skipmissing=:listwise)
@test_throws Union{ArgumentError,MethodError} pairwise!(f, res, xm, ym, skipmissing=:pairwise)
@test_throws Union{ArgumentError,MethodError} pairwise!(f, res, xm, ym, skipmissing=:listwise)
end

for sm in (:pairwise, :listwise)
Expand Down