Skip to content

Commit

Permalink
Fix deprecation warnings in tests (#259)
Browse files Browse the repository at this point in the history
  • Loading branch information
ararslan authored May 10, 2017
1 parent 5fdbe1c commit 1ac90eb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions test/moments.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ w = [3.84, 2.70, 8.29, 8.91, 9.71, 0.0]

# expected uncorrected output
expected_var = sum(abs2.(x .- m), wv) / sum(wv)
expected_std = sqrt(expected_var)
expected_std = sqrt.(expected_var)

@testset "Variance" begin
@test var(x, wv; corrected=false) expected_var
Expand Down Expand Up @@ -50,7 +50,7 @@ end

# expected corrected output for (weights, aweights, fweights, pweights)
expected_var = [NaN, 0.0694434191182236, 0.05466601256158146, 0.06628969012045285]
expected_std = sqrt(expected_var)
expected_std = sqrt.(expected_var)

@testset "Corrected with $(weight_funcs[i])" for i in eachindex(weight_funcs)
wv = weight_funcs[i](w)
Expand Down
6 changes: 3 additions & 3 deletions test/sampling.jl
Original file line number Diff line number Diff line change
Expand Up @@ -191,18 +191,18 @@ wv = Weights([zeros(6); 1:4])
x = vcat([sample(a, wv, 1, replace=false) for j in 1:100000]...)
@test minimum(x) == 7
@test maximum(x) == 10
@test maximum(abs(proportions(x) - (1:4)/10)) < 0.01
@test maximum(abs, proportions(x) - (1:4)/10) < 0.01

x = vcat([sample(a, wv, 2, replace=false) for j in 1:50000]...)
exact2 = [0.117261905, 0.220634921, 0.304166667, 0.357936508]
@test minimum(x) == 7
@test maximum(x) == 10
@test maximum(abs(proportions(x) - exact2)) < 0.01
@test maximum(abs, proportions(x) - exact2) < 0.01

x = vcat([sample(a, wv, 4, replace=false) for j in 1:10000]...)
@test minimum(x) == 7
@test maximum(x) == 10
@test maximum(abs(proportions(x) - 0.25)) == 0
@test maximum(abs, proportions(x) - 0.25) == 0

@test_throws DimensionMismatch sample(a, wv, 5, replace=false)

Expand Down

0 comments on commit 1ac90eb

Please sign in to comment.