Skip to content

Commit f6dd1d5

Browse files
committed
Simplify context testing
1 parent a6a42bd commit f6dd1d5

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/test_utils/contexts.jl

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,13 @@ This method ensures that `context`
2525
- Correctly implements the tilde-pipeline.
2626
"""
2727
function test_context(context::DynamicPPL.AbstractContext, model::DynamicPPL.Model)
28-
# `NodeTrait`.
2928
node_trait = DynamicPPL.NodeTrait(context)
30-
# Throw error immediately if it it's missing a `NodeTrait` implementation.
31-
node_trait isa Union{DynamicPPL.IsLeaf,DynamicPPL.IsParent} ||
32-
error("Invalid NodeTrait: $node_trait")
33-
3429
if node_trait isa DynamicPPL.IsLeaf
3530
test_leaf_context(context, model)
36-
else
31+
elseif node_trait isa DynamicPPL.IsParent
3732
test_parent_context(context, model)
33+
else
34+
error("Invalid NodeTrait: $node_trait")
3835
end
3936
end
4037

0 commit comments

Comments
 (0)