Skip to content

Commit

Permalink
make Statistics consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
simonbyrne committed Apr 28, 2019
1 parent d4968e2 commit 519fb6d
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions stdlib/Statistics/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ end
end

@testset "mean" begin
@test_throws MethodError mean(())
@test_throws ArgumentError mean(())
@test mean((1,2,3)) === 2.
@test mean([0]) === 0.
@test mean([1.]) === 1.
Expand Down Expand Up @@ -108,8 +108,8 @@ end
@test mean(Int[]) isa Float64
@test isequal(mean(skipmissing(Int[])), NaN)
@test mean(skipmissing(Int[])) isa Float64
@test_throws MethodError mean([])
@test_throws MethodError mean(skipmissing([]))
@test_throws ArgumentError mean([])
@test_throws ArgumentError mean(skipmissing([]))
@test_throws ArgumentError mean((1 for i in 2:1))

# Check that small types are accumulated using wider type
Expand All @@ -136,10 +136,10 @@ end
@testset "var & std" begin
# edge case: empty vector
# iterable; this has to throw for type stability
@test_throws MethodError var(())
@test_throws MethodError var((); corrected=false)
@test_throws MethodError var((); mean=2)
@test_throws MethodError var((); mean=2, corrected=false)
@test_throws ArgumentError var(())
@test_throws ArgumentError var((); corrected=false)
@test_throws ArgumentError var((); mean=2)
@test_throws ArgumentError var((); mean=2, corrected=false)
# reduction
@test isnan(var(Int[]))
@test isnan(var(Int[]; corrected=false))
Expand Down Expand Up @@ -277,9 +277,9 @@ end
@test var(Complex{Float64}[]) isa Float64
@test isequal(var(skipmissing(Complex{Float64}[])), NaN)
@test var(skipmissing(Complex{Float64}[])) isa Float64
@test_throws MethodError var([])
@test_throws MethodError var(skipmissing([]))
@test_throws MethodError var((1 for i in 2:1))
@test_throws ArgumentError var([])
@test_throws ArgumentError var(skipmissing([]))
@test_throws ArgumentError var((1 for i in 2:1))
@test isequal(var(Int[]), NaN)
@test var(Int[]) isa Float64
@test isequal(var(skipmissing(Int[])), NaN)
Expand Down

0 comments on commit 519fb6d

Please sign in to comment.