Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
penelopeysm and github-actions[bot] authored Nov 27, 2024
1 parent 3f72a46 commit fc6025a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
8 changes: 6 additions & 2 deletions ext/DynamicPPLTestExt/contexts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ function DynamicPPL.setchildcontext(
)
return DynamicPPL.TestUtils.TestLogModifyingChildContext(context.mod, child)
end
function DynamicPPL.tilde_assume(context::DynamicPPL.TestUtils.TestLogModifyingChildContext, right, vn, vi)
function DynamicPPL.tilde_assume(
context::DynamicPPL.TestUtils.TestLogModifyingChildContext, right, vn, vi
)
value, logp, vi = DynamicPPL.tilde_assume(context.context, right, vn, vi)
return value, logp * context.mod, vi
end
Expand All @@ -50,7 +52,9 @@ function DynamicPPL.dot_tilde_assume(
value, logp, vi = DynamicPPL.dot_tilde_assume(context.context, right, left, vn, vi)
return value, logp * context.mod, vi
end
function DynamicPPL.tilde_observe(context::DynamicPPL.TestUtils.TestLogModifyingChildContext, right, left, vi)
function DynamicPPL.tilde_observe(
context::DynamicPPL.TestUtils.TestLogModifyingChildContext, right, left, vi
)
logp, vi = DynamicPPL.tilde_observe(context.context, right, left, vi)
return logp * context.mod, vi
end
Expand Down
4 changes: 3 additions & 1 deletion ext/DynamicPPLTestExt/sampler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ Test that `sampler` produces the correct marginal posterior means on all models
As of right now, this is just an alias for [`test_sampler_on_demo_models`](@ref).
"""
function DynamicPPL.TestUtils.test_sampler_continuous(sampler::AbstractMCMC.AbstractSampler, args...; kwargs...)
function DynamicPPL.TestUtils.test_sampler_continuous(
sampler::AbstractMCMC.AbstractSampler, args...; kwargs...
)
return test_sampler_on_demo_models(sampler, args...; kwargs...)
end
4 changes: 3 additions & 1 deletion ext/DynamicPPLTestExt/varinfo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
Test that `vi[vn]` corresponds to the correct value in `vals` for every `vn` in `vns`.
"""
function DynamicPPL.TestUtils.test_values(vi::AbstractVarInfo, vals::NamedTuple, vns; compare=isequal, kwargs...)
function DynamicPPL.TestUtils.test_values(
vi::AbstractVarInfo, vals::NamedTuple, vns; compare=isequal, kwargs...
)
for vn in vns
@test compare(vi[vn], get(vals, vn); kwargs...)
end
Expand Down
1 change: 0 additions & 1 deletion src/test_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ using Bijectors: Bijectors
include("test_utils/model_interface.jl")
include("test_utils/models.jl")


##############################################################
# The remainder of this file contains skeleton implementations for
# DynamicPPLTestExt
Expand Down

0 comments on commit fc6025a

Please sign in to comment.