Skip to content

Commit 4492504

Browse files
committed
added some simple tests for conditioning for NamedDist
1 parent b193140 commit 4492504

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/compiler.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,18 @@ end
312312
@test vi2.metadata.y.vns[1] == @varname(y[2][:, 1])
313313
@test haskey(vi3.metadata, :y)
314314
@test vi3.metadata.y.vns[1] == @varname(y[1])
315+
316+
# Conditioning
317+
f1_c = f1() | (y=1,)
318+
f2_c = f2() | NamedTuple((Symbol(@varname(y[2][:, 1])) => 1,))
319+
f3_c = f3() | NamedTuple((Symbol(@varname(y[1])) => 1,))
320+
@test f1_c() == 1
321+
# TODO(torfjelde): We need conditioning for `Dict`.
322+
@test_broken f2_c() == 1
323+
@test_broken f3_c() == 1
324+
@test_broken getlogp(VarInfo(f1_c)) ==
325+
getlogp(VarInfo(f2_c)) ==
326+
getlogp(VarInfo(f3_c))
315327
end
316328
@testset "custom tilde" begin
317329
@model demo() = begin

0 commit comments

Comments
 (0)