Skip to content

Commit 891b4b3

Browse files
committed
Improve comments
1 parent 2cfc297 commit 891b4b3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/test_utils/contexts.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,16 @@ function test_leaf_context(context::DynamicPPL.AbstractContext, model::DynamicPP
3939
@test DynamicPPL.NodeTrait(context) isa DynamicPPL.IsLeaf
4040

4141
# Note that for a leaf context we can't assume that it will work with an
42-
# empty VarInfo. Thus we only test evaluation (i.e., assuming that the
43-
# varinfo already contains all necessary variables).
42+
# empty VarInfo. (For example, DefaultContext will error with empty
43+
# varinfos.) Thus we only test evaluation with VarInfos that are already
44+
# filled with values.
4445
@testset "evaluation" begin
4546
# Generate a new filled untyped varinfo
4647
_, untyped_vi = DynamicPPL.init!!(model, DynamicPPL.VarInfo())
4748
typed_vi = DynamicPPL.typed_varinfo(untyped_vi)
48-
new_model = contextualize(model, context)
49+
# Set the test context as the new leaf context
50+
new_model = contextualize(model, DynamicPPL.setleafcontext(model.context, context))
51+
# Check that evaluation works
4952
for vi in [untyped_vi, typed_vi]
5053
_, vi = DynamicPPL.evaluate!!(new_model, vi)
5154
@test vi isa DynamicPPL.VarInfo

0 commit comments

Comments
 (0)