Skip to content

Commit

Permalink
Merge pull request #103 from TuringLang/dw/improve_tests
Browse files Browse the repository at this point in the history
More stable tests
  • Loading branch information
cpfiffer authored Jun 1, 2022
2 parents 8d7f22f + 346c6a2 commit 5b75d15
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ uuid = "80f14c24-f653-4e6a-9b94-39d6b0f70001"
keywords = ["markov chain monte carlo", "probablistic programming"]
license = "MIT"
desc = "A lightweight interface for common MCMC methods."
version = "4.1.1"
version = "4.1.2"

[deps]
BangBang = "198e06fe-97b7-11e9-32a5-e1d131e6ad66"
Expand Down
9 changes: 5 additions & 4 deletions test/stepper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
chain = sample(
MyModel(), MySampler(), N; discard_initial=discard_initial, progress=false
)
@test all(as[i] === chain[i].a for i in 1:N)
@test all(bs[i] === chain[i].b for i in 1:N)
@test all(as[i] == chain[i].a for i in 1:N)
@test all(bs[i] == chain[i].b for i in 1:N)
end

@testset "Thin chain by a factor of `thinning`" begin
Expand All @@ -68,7 +68,8 @@
# Repeat sampling with `sample`.
Random.seed!(1234)
chain = sample(MyModel(), MySampler(), N; thinning=thinning, progress=false)
@test all(as[i] === chain[i].a for i in 1:N)
@test all(bs[i] === chain[i].b for i in 1:N)
@test as[1] === chain[1].a === missing
@test all(as[i] == chain[i].a for i in 2:N)
@test all(bs[i] == chain[i].b for i in 1:N)
end
end
9 changes: 5 additions & 4 deletions test/transducer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@
chain = sample(
MyModel(), MySampler(), N; discard_initial=discard_initial, progress=false
)
@test all(as[i] === chain[i].a for i in 1:N)
@test all(bs[i] === chain[i].b for i in 1:N)
@test all(as[i] == chain[i].a for i in 1:N)
@test all(bs[i] == chain[i].b for i in 1:N)
end

@testset "Thin chain by a factor of `thinning`" begin
Expand All @@ -92,7 +92,8 @@
# Repeat sampling with `sample`.
Random.seed!(1234)
chain = sample(MyModel(), MySampler(), N; thinning=thinning, progress=false)
@test all(as[i] === chain[i].a for i in 1:N)
@test all(bs[i] === chain[i].b for i in 1:N)
@test as[1] === chain[1].a === missing
@test all(as[i] == chain[i].a for i in 2:N)
@test all(bs[i] == chain[i].b for i in 1:N)
end
end

2 comments on commit 5b75d15

@cpfiffer
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/61508

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v4.1.2 -m "<description of version>" 5b75d15b57af7e38a47d537f2e2297cd3786e2ff
git push origin v4.1.2

Please sign in to comment.