Skip to content

Commit

Permalink
Add value_iterator_from_chain tests from test/turing/model.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
penelopeysm committed Nov 29, 2024
1 parent b52aa73 commit 1055a10
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/model_utils.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@testset "model_utils.jl" begin

@testset "value_iterator_from_chain" begin
@testset "$model" for model in DynamicPPL.TestUtils.DEMO_MODELS
chain = make_chain_from_prior(model, 10)
for (i, d) in enumerate(value_iterator_from_chain(model, chain))
for vn in keys(d)
val = DynamicPPL.getvalue(d, vn)
for vn_leaf in DynamicPPL.varname_leaves(vn, val)
val_leaf = DynamicPPL.getvalue(d, vn_leaf)
@test val_leaf == chain[i, Symbol(vn_leaf), 1]
end
end
end
end
end

end

0 comments on commit 1055a10

Please sign in to comment.