File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ using Distributions
55using Test
66
77@testset " submodels.jl" begin
8- @testset " $op " for op in [condition, fix]
8+ @testset " $op with AbstractPPL API " for op in [condition, fix]
99 x_val = 1.0
1010 x_logp = op == condition ? logpdf (Normal (), x_val) : 0.0
1111
@@ -139,6 +139,22 @@ using Test
139139 @test Set (keys (VarInfo (h3 ()))) == Set ([@varname (a. b. y)])
140140 end
141141 end
142+
143+ @testset " conditioning via model arguments" begin
144+ @model function f (x)
145+ x ~ Normal ()
146+ return y ~ Normal ()
147+ end
148+ @model function g (inner_x)
149+ return a ~ to_submodel (f (inner_x))
150+ end
151+
152+ vi = VarInfo (g (1.0 ))
153+ @test Set (keys (vi)) == Set ([@varname (a. y)])
154+
155+ vi = VarInfo (g (missing ))
156+ @test Set (keys (vi)) == Set ([@varname (a. x), @varname (a. y)])
157+ end
142158end
143159
144160end
You can’t perform that action at this time.
0 commit comments