From 8f61785fa113f93fbd0e86313a73173d14aadb51 Mon Sep 17 00:00:00 2001 From: Phillip Alday Date: Wed, 14 Jul 2021 19:24:52 +0200 Subject: [PATCH] fix tests for change in default RNG on nightly (#699) * fix tests for change in default RNG on nightly * ditch redundant test --- test/sampling.jl | 7 ++++--- test/statmodels.jl | 6 ++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/test/sampling.jl b/test/sampling.jl index 66bb02313..15bf69f37 100644 --- a/test/sampling.jl +++ b/test/sampling.jl @@ -219,11 +219,12 @@ wv = Weights([zeros(5); 1:4; -1]) @test_throws ErrorException sample(a, wv, 1, replace=false) #### weighted sampling with dimension -Random.seed!(1); -@test sample([1, 2], Weights([1, 1]), (2,2)) == ones(2,2) +# weights respected; this works because of the 0-weight @test sample([1, 2], Weights([0, 1]), (2,2)) == [2 2 ; 2 2] -@test sample(collect(1:4), Weights(1:4), (2,2), replace=false) == [4 1; 3 2] +wm = sample(collect(1:4), Weights(1:4), (2,2), replace=false) +@test size(wm) == (2, 2) # correct shape +@test length(Set(wm)) == 4 # no duplicates in elements #### check that sample and sample! do the same thing diff --git a/test/statmodels.jl b/test/statmodels.jl index c72da5684..da8824cf3 100644 --- a/test/statmodels.jl +++ b/test/statmodels.jl @@ -56,8 +56,10 @@ x3 1.56734e-13 Bad 2 0.00 <1e-15 (Name = "x3", Estimate = 1.56734e-13, Comments = "Bad", df = 2, t = 2.68e-16, p = 1.345e-16) ] -Random.seed!(10) -m = rand(3,4) + +m = [0.11258244478647295 0.05664544616214151 0.38181274408522614 0.8197779704008801 + 0.36831406658084287 0.12078054506961555 0.8151038332483567 0.6699313951612162 + 0.3444540231363058 0.17957407667101322 0.2422083248151139 0.4530583319523316] ct = CoefTable(m, ["Estimate", "Stderror", "df", "p"], [], 4) @test sprint(show, ct) == """ ──────────────────────────────────────────