1- using AbstractPPL
1+ using AbstractPPL. GraphPPL
22using SparseArrays
33
44# # Example taken from Mamba
@@ -19,9 +19,10 @@ model = (
1919
2020# construct the model!
2121m = Model (; zip (keys (model), values (model))... ) # uses Model(; kwargs...) constructor
22-
22+ typeof (m)
2323# test the type of the model is correct
24- @test typeof (m) == Model
24+ @test typeof (m) <: Model
25+ @test typeof (m) == Model{(:s2 , :xmat , :β , :μ , :y )}
2526@test typeof (m. g) <: GraphInfo <: AbstractModelTrace
2627@test typeof (m. g) == GraphInfo{(:s2 , :xmat , :β , :μ , :y )}
2728
@@ -33,7 +34,7 @@ A = sparse([0 0 0 0 0; 0 0 0 0 0; 0 0 0 0 0; 0 1 1 0 0; 1 0 0 1 0])
3334@test eltype (m) == valtype (m)
3435
3536# check the values from the NamedTuple match the values in the fields of GraphInfo
36- vals = AbstractPPL. getvals (model)
37+ vals = AbstractPPL. GraphPPL . getvals (model)
3738for (i, field) in enumerate ([:value , :eval , :kind ])
3839 @test eval ( :( values (m. g.$ field) == vals[$ i] ) )
3940end
5253
5354# test Model constructor for model with single parent node
5455single_parent_m = Model (μ = (1.0 , () -> 3 , :Logical ), y = (1.0 , (μ) -> MvNormal (μ, sqrt (1 )), :Stochastic ))
55- @test typeof (single_parent_m) == Model
56+ @test typeof (single_parent_m) == Model{( :μ , :y )}
5657@test typeof (single_parent_m. g) == GraphInfo{(:μ , :y )}
5758
5859# test ErrorException for parent node not found
0 commit comments