File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 162
162
@test getoptic (vn_prefixed) === getoptic (vn)
163
163
end
164
164
165
+ @testset " nested within arbitrary context stacks" begin
166
+ vn = @varname (x[1 ])
167
+ ctx1 = PrefixContext {:a} (DefaultContext ())
168
+ ctx2 = SamplingContext (ctx1)
169
+ ctx3 = PrefixContext {:b} (ctx2)
170
+ ctx4 = DynamicPPL. ValuesAsInModelContext (OrderedDict (), false , ctx3)
171
+ vn_prefixed1 = prefix (ctx1, vn)
172
+ vn_prefixed2 = prefix (ctx2, vn)
173
+ vn_prefixed3 = prefix (ctx3, vn)
174
+ vn_prefixed4 = prefix (ctx4, vn)
175
+ @test DynamicPPL. getsym (vn_prefixed1) == Symbol (" a.x" )
176
+ @test DynamicPPL. getsym (vn_prefixed2) == Symbol (" a.x" )
177
+ @test DynamicPPL. getsym (vn_prefixed3) == Symbol (" a.b.x" )
178
+ @test DynamicPPL. getsym (vn_prefixed4) == Symbol (" a.b.x" )
179
+ @test DynamicPPL. getoptic (vn_prefixed1) === DynamicPPL. getoptic (vn)
180
+ @test DynamicPPL. getoptic (vn_prefixed2) === DynamicPPL. getoptic (vn)
181
+ @test DynamicPPL. getoptic (vn_prefixed3) === DynamicPPL. getoptic (vn)
182
+ @test DynamicPPL. getoptic (vn_prefixed4) === DynamicPPL. getoptic (vn)
183
+ end
184
+
165
185
context = DynamicPPL. PrefixContext {:prefix} (SamplingContext ())
166
186
@testset " evaluation: $(model. f) " for model in DynamicPPL. TestUtils. DEMO_MODELS
167
187
# Sample with the context.
You can’t perform that action at this time.
0 commit comments