Skip to content

Commit

Permalink
try fixing naming conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
sunxd3 committed Dec 20, 2024
1 parent a3fc8b1 commit da7fa1c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/contexts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -202,27 +202,27 @@ end
s, m = retval.s, retval.m

# Keword approach.
model_fixed = fix(model; s=s)
model_fixed = DynamicPPL.fix(model; s=s)
@test model_fixed().s == s
@test model_fixed().m != m
# A fixed variable should not contribute at all to the logjoint.
# Assuming `condition` is correctly implemented, the following should hold.
@test logprior(model_fixed, (; m)) == logprior(condition(model; s=s), (; m))

# Positional approach.
model_fixed = fix(model, (; s))
model_fixed = DynamicPPL.fix(model, (; s))
@test model_fixed().s == s
@test model_fixed().m != m
@test logprior(model_fixed, (; m)) == logprior(condition(model; s=s), (; m))

# Pairs approach.
model_fixed = fix(model, @varname(s) => s)
model_fixed = DynamicPPL.fix(model, @varname(s) => s)
@test model_fixed().s == s
@test model_fixed().m != m
@test logprior(model_fixed, (; m)) == logprior(condition(model; s=s), (; m))

# Dictionary approach.
model_fixed = fix(model, Dict(@varname(s) => s))
model_fixed = DynamicPPL.fix(model, Dict(@varname(s) => s))
@test model_fixed().s == s
@test model_fixed().m != m
@test logprior(model_fixed, (; m)) == logprior(condition(model; s=s), (; m))
Expand Down

0 comments on commit da7fa1c

Please sign in to comment.