From 9e0b0ba93504c24aa68294e81619e392597e83cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bogumi=C5=82=20Kami=C5=84ski?= Date: Tue, 4 Sep 2018 18:18:01 +0200 Subject: [PATCH] further cleanup of tests --- stdlib/Statistics/test/runtests.jl | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/stdlib/Statistics/test/runtests.jl b/stdlib/Statistics/test/runtests.jl index 228875e4525ba..6f0c4d7bdb1c3 100644 --- a/stdlib/Statistics/test/runtests.jl +++ b/stdlib/Statistics/test/runtests.jl @@ -87,18 +87,20 @@ end @test isequal(mean([missing 1.0; 2.0 3.0], dims=1), [missing 2.0]) @test mean(skipmissing([1, missing, 2])) === 1.5 @test isequal(mean(Complex{Float64}[]), NaN+NaN*im) - @test isequal(mean(skipmissing(Complex{Float64}[])), NaN+NaN*im) @test mean(Complex{Float64}[]) isa Complex{Float64} + @test isequal(mean(skipmissing(Complex{Float64}[])), NaN+NaN*im) @test mean(skipmissing(Complex{Float64}[])) isa Complex{Float64} @test isequal(mean(abs, Complex{Float64}[]), NaN) - @test isequal(mean(abs, skipmissing(Complex{Float64}[])), NaN) @test mean(abs, Complex{Float64}[]) isa Float64 + @test isequal(mean(abs, skipmissing(Complex{Float64}[])), NaN) @test mean(abs, skipmissing(Complex{Float64}[])) isa Float64 - @test_throws MethodError mean([]) - @test_throws MethodError mean(skipmissing([])) - @test_throws MethodError mean((1 for i in 2:1)) + @test isequal(mean(Int[]), NaN) @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((1 for i in 2:1)) # Check that small types are accumulated using wider type for T in (Int8, UInt8) @@ -260,13 +262,15 @@ end end @test isequal(var(Complex{Float64}[]), NaN) - @test isequal(var(skipmissing(Complex{Float64}[])), NaN) @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 ArgumentError var((1 for i in 2:1)) + @test_throws MethodError var((1 for i in 2:1)) + @test isequal(var(Int[]), NaN) @test var(Int[]) isa Float64 + @test isequal(var(skipmissing(Int[])), NaN) @test var(skipmissing(Int[])) isa Float64 end