Skip to content

Commit 7d7e404

Browse files
committed
fix tests for error types
We do not care about the actual error code here, but as seen on some of the other tests that needed similar fixes, these obstruct improvements to Base error messages.
1 parent e9ac70b commit 7d7e404

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

test/runtests.jl

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ end
138138
@test mean(Int[]) isa Float64
139139
@test isequal(mean(skipmissing(Int[])), NaN)
140140
@test mean(skipmissing(Int[])) isa Float64
141-
@test_throws MethodError mean([])
142-
@test_throws MethodError mean(skipmissing([]))
141+
@test_throws Exception mean([])
142+
@test_throws Exception mean(skipmissing([]))
143143
@test_throws ArgumentError mean((1 for i in 2:1))
144144
if VERSION >= v"1.6.0-DEV.83"
145145
@test_throws ArgumentError mean(())
@@ -187,10 +187,10 @@ end
187187
@testset "var & std" begin
188188
# edge case: empty vector
189189
# iterable; this has to throw for type stability
190-
@test_throws MethodError var(())
191-
@test_throws MethodError var((); corrected=false)
192-
@test_throws MethodError var((); mean=2)
193-
@test_throws MethodError var((); mean=2, corrected=false)
190+
@test_throws Exception var(())
191+
@test_throws Exception var((); corrected=false)
192+
@test_throws Exception var((); mean=2)
193+
@test_throws Exception var((); mean=2, corrected=false)
194194
# reduction
195195
@test isnan(var(Int[]))
196196
@test isnan(var(Int[]; corrected=false))
@@ -331,9 +331,9 @@ end
331331
@test var(Complex{Float64}[]) isa Float64
332332
@test isequal(var(skipmissing(Complex{Float64}[])), NaN)
333333
@test var(skipmissing(Complex{Float64}[])) isa Float64
334-
@test_throws MethodError var([])
335-
@test_throws MethodError var(skipmissing([]))
336-
@test_throws MethodError var((1 for i in 2:1))
334+
@test_throws Exception var([])
335+
@test_throws Exception var(skipmissing([]))
336+
@test_throws Exception var((1 for i in 2:1))
337337
@test isequal(var(Int[]), NaN)
338338
@test var(Int[]) isa Float64
339339
@test isequal(var(skipmissing(Int[])), NaN)
@@ -464,9 +464,9 @@ Y = [6.0 2.0;
464464
@testset "cov with missing" begin
465465
@test cov([missing]) === cov([1, missing]) === missing
466466
@test cov([1, missing], [2, 3]) === cov([1, 3], [2, missing]) === missing
467-
@test_throws MethodError cov([1 missing; 2 3])
468-
@test_throws MethodError cov([1 missing; 2 3], [1, 2])
469-
@test_throws MethodError cov([1, 2], [1 missing; 2 3])
467+
@test_throws Exception cov([1 missing; 2 3])
468+
@test_throws Exception cov([1 missing; 2 3], [1, 2])
469+
@test_throws Exception cov([1, 2], [1 missing; 2 3])
470470
@test isequal(cov([1 2; 2 3], [1, missing]), [missing missing]')
471471
@test isequal(cov([1, missing], [1 2; 2 3]), [missing missing])
472472
end
@@ -559,25 +559,25 @@ end
559559

560560
@test cor(Int[]) === 1.0
561561
@test cor([im]) === 1.0 + 0.0im
562-
@test_throws MethodError cor([])
563-
@test_throws MethodError cor(Any[1.0])
562+
@test_throws Exception cor([])
563+
@test_throws Exception cor(Any[1.0])
564564

565565
@test cor([1, missing]) === 1.0
566566
@test ismissing(cor([missing]))
567-
@test_throws MethodError cor(Any[1.0, missing])
567+
@test_throws Exception cor(Any[1.0, missing])
568568

569569
@test Statistics.corm([true], 1.0) === 1.0
570-
@test_throws MethodError Statistics.corm(Any[0.0, 1.0], 0.5)
570+
@test_throws Exception Statistics.corm(Any[0.0, 1.0], 0.5)
571571
@test Statistics.corzm([true]) === 1.0
572-
@test_throws MethodError Statistics.corzm(Any[0.0, 1.0])
572+
@test_throws Exception Statistics.corzm(Any[0.0, 1.0])
573573

574574
@testset "cor with missing" begin
575575
@test cor([missing]) === missing
576576
@test cor([1, missing]) == 1
577577
@test cor([1, missing], [2, 3]) === cor([1, 3], [2, missing]) === missing
578-
@test_throws MethodError cor([1 missing; 2 3])
579-
@test_throws MethodError cor([1 missing; 2 3], [1, 2])
580-
@test_throws MethodError cor([1, 2], [1 missing; 2 3])
578+
@test_throws Exception cor([1 missing; 2 3])
579+
@test_throws Exception cor([1 missing; 2 3], [1, 2])
580+
@test_throws Exception cor([1, 2], [1 missing; 2 3])
581581
@test isequal(cor([1 2; 2 3], [1, missing]), [missing missing]')
582582
@test isequal(cor([1, missing], [1 2; 2 3]), [missing missing])
583583
end

0 commit comments

Comments
 (0)