Skip to content

Commit

Permalink
added VarNameDict to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
torfjelde committed Sep 1, 2023
1 parent d103215 commit ad53ca9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/test_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,17 @@ function setup_varinfos(model::Model, example_values::NamedTuple, varnames)
svi_typed_ref = SimpleVarInfo(example_values, Ref(getlogp(svi_typed)))
svi_untyped_ref = SimpleVarInfo(OrderedDict(), Ref(getlogp(svi_untyped)))

svi_vardict = SimpleVarInfo(VarNameDict())

lp = getlogp(vi_typed)
return map((
vi_untyped, vi_typed, svi_typed, svi_untyped, svi_typed_ref, svi_untyped_ref
vi_untyped,
vi_typed,
svi_typed,
svi_untyped,
svi_typed_ref,
svi_untyped_ref,
svi_vardict,
)) do vi
# Set them all to the same values.
DynamicPPL.setlogp!!(update_values!!(vi, example_values, varnames), lp)
Expand Down
1 change: 1 addition & 0 deletions test/test_util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ short_varinfo_name(::TypedVarInfo) = "TypedVarInfo"
short_varinfo_name(::UntypedVarInfo) = "UntypedVarInfo"
short_varinfo_name(::SimpleVarInfo{<:NamedTuple}) = "SimpleVarInfo{<:NamedTuple}"
short_varinfo_name(::SimpleVarInfo{<:OrderedDict}) = "SimpleVarInfo{<:OrderedDict}"
short_varinfo_name(::SimpleVarInfo{<:VarNameDict}) = "SimpleVarInfo{<:VarNameDict}"

# convenient functions for testing model.jl
# function to modify the representation of values based on their length
Expand Down

0 comments on commit ad53ca9

Please sign in to comment.