Skip to content

Commit db4e86e

Browse files
fix model construction unit tests
1 parent 27bdbce commit db4e86e

1 file changed

Lines changed: 29 additions & 4 deletions

File tree

test/unit_tests/model.jl

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,13 @@ function test_params_api(semobj, spec::SemSpecification)
4747
@test @inferred(param_labels(semobj)) == param_labels(spec)
4848
end
4949

50-
@testset "Sem(implied=$impliedtype, loss=$losstype)" for impliedtype in (RAM, RAMSymbolic),
51-
losstype in (SemML, SemWLS)
50+
@testset "Sem(implied=$impliedtype, loss=SemML)" for impliedtype in (RAM, RAMSymbolic)
5251

5352
model = Sem(
5453
specification = ram_matrices,
5554
observed = obs,
5655
implied = impliedtype,
57-
loss = losstype,
56+
loss = SemML,
5857
)
5958

6059
@test model isa Sem
@@ -69,7 +68,33 @@ end
6968

7069
@test @inferred(loss(model)) isa SemLoss
7170
semloss = loss(model).functions[1]
72-
@test semloss isa losstype
71+
@test semloss isa SemML
7372

7473
@test @inferred(nsamples(model)) == nsamples(obs)
7574
end
75+
76+
@testset "Sem(implied=RAMSymbolic, loss=SemWLS)" begin
77+
78+
model = Sem(
79+
specification = ram_matrices,
80+
observed = obs,
81+
implied = RAMSymbolic,
82+
loss = SemWLS,
83+
)
84+
85+
@test model isa Sem
86+
@test @inferred(implied(model)) isa RAMSymbolic
87+
@test @inferred(observed(model)) isa SemObserved
88+
89+
test_vars_api(model, ram_matrices)
90+
test_params_api(model, ram_matrices)
91+
92+
test_vars_api(implied(model), ram_matrices)
93+
test_params_api(implied(model), ram_matrices)
94+
95+
@test @inferred(loss(model)) isa SemLoss
96+
semloss = loss(model).functions[1]
97+
@test semloss isa SemWLS
98+
99+
@test @inferred(nsamples(model)) == nsamples(obs)
100+
end

0 commit comments

Comments
 (0)