Skip to content

Commit 8f61785

Browse files
authored
fix tests for change in default RNG on nightly (#699)
* fix tests for change in default RNG on nightly * ditch redundant test
1 parent 2faa6e8 commit 8f61785

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

test/sampling.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,12 @@ wv = Weights([zeros(5); 1:4; -1])
219219
@test_throws ErrorException sample(a, wv, 1, replace=false)
220220

221221
#### weighted sampling with dimension
222-
Random.seed!(1);
223222

224-
@test sample([1, 2], Weights([1, 1]), (2,2)) == ones(2,2)
223+
# weights respected; this works because of the 0-weight
225224
@test sample([1, 2], Weights([0, 1]), (2,2)) == [2 2 ; 2 2]
226-
@test sample(collect(1:4), Weights(1:4), (2,2), replace=false) == [4 1; 3 2]
225+
wm = sample(collect(1:4), Weights(1:4), (2,2), replace=false)
226+
@test size(wm) == (2, 2) # correct shape
227+
@test length(Set(wm)) == 4 # no duplicates in elements
227228

228229

229230
#### check that sample and sample! do the same thing

test/statmodels.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,10 @@ x3 1.56734e-13 Bad 2 0.00 <1e-15
5656
(Name = "x3", Estimate = 1.56734e-13, Comments = "Bad", df = 2, t = 2.68e-16, p = 1.345e-16)
5757
]
5858

59-
Random.seed!(10)
60-
m = rand(3,4)
59+
60+
m = [0.11258244478647295 0.05664544616214151 0.38181274408522614 0.8197779704008801
61+
0.36831406658084287 0.12078054506961555 0.8151038332483567 0.6699313951612162
62+
0.3444540231363058 0.17957407667101322 0.2422083248151139 0.4530583319523316]
6163
ct = CoefTable(m, ["Estimate", "Stderror", "df", "p"], [], 4)
6264
@test sprint(show, ct) == """
6365
──────────────────────────────────────────

0 commit comments

Comments
 (0)