Skip to content

Commit b901d97

Browse files
committed
tests/examples: import -> using
no declarations, so import is not required
1 parent e084533 commit b901d97

File tree

6 files changed

+19
-24
lines changed

6 files changed

+19
-24
lines changed

test/examples/multigroup/build_models.jl

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,16 +134,15 @@ struct UserSemML <: SemLossFunction end
134134
### functors
135135
############################################################################################
136136

137-
import LinearAlgebra: isposdef, logdet, tr, inv
138-
import StructuralEquationModels: Σ, obs_cov, objective!
139-
140-
function objective!(semml::UserSemML, parameters, model::AbstractSem)
141-
let Σ = Σ(imply(model)), Σₒ = obs_cov(observed(model))
142-
if !isposdef(Σ)
143-
return Inf
144-
else
145-
return logdet(Σ) + tr(inv(Σ) * Σₒ)
146-
end
137+
using LinearAlgebra: isposdef, logdet, tr, inv
138+
139+
function SEM.objective!(semml::UserSemML, parameters, model::AbstractSem)
140+
Σ = imply(model).Σ
141+
Σₒ = SEM.obs_cov(observed(model))
142+
if !isposdef(Σ)
143+
return Inf
144+
else
145+
return logdet(Σ) + tr(inv(Σ) * Σₒ)
147146
end
148147
end
149148

test/examples/multigroup/multigroup.jl

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
using StructuralEquationModels, Test, FiniteDiff
2-
import LinearAlgebra: diagind, LowerTriangular
3-
# import StructuralEquationModels as SEM
4-
include(
5-
joinpath(
6-
chop(dirname(pathof(StructuralEquationModels)), tail = 3),
7-
"test/examples/helper.jl",
8-
),
9-
)
2+
using LinearAlgebra: diagind, LowerTriangular
3+
4+
const SEM = StructuralEquationModels
5+
6+
include(joinpath(chop(dirname(pathof(SEM)), tail = 3), "test/examples/helper.jl"))
107

118
dat = example_data("holzinger_swineford")
129
dat_missing = example_data("holzinger_swineford_missing")

test/examples/political_democracy/constructor.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Statistics: cov, mean
1+
using Statistics: cov, mean
22

33
############################################################################################
44
### models w.o. meanstructure

test/examples/political_democracy/political_democracy.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using StructuralEquationModels, Test, FiniteDiff
2-
# import StructuralEquationModels as SEM
2+
33
include(
44
joinpath(
55
chop(dirname(pathof(StructuralEquationModels)), tail = 3),

test/examples/recover_parameters/recover_parameters_twofact.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using StructuralEquationModels, Distributions, Random, Optim, LineSearches
2-
import StructuralEquationModels as SEM
2+
33
include(
44
joinpath(
55
chop(dirname(pathof(StructuralEquationModels)), tail = 3),
@@ -63,7 +63,7 @@ Random.seed!(1234)
6363
x = transpose(rand(true_dist, 100000))
6464
semobserved = SemObservedData(data = x, specification = nothing)
6565

66-
loss_ml = SemLoss(SEM.SemML(; observed = semobserved, n_par = length(start)))
66+
loss_ml = SemLoss(SemML(; observed = semobserved, n_par = length(start)))
6767

6868
optimizer = SemOptimizerOptim(
6969
BFGS(; linesearch = BackTracking(order = 3), alphaguess = InitialHagerZhang()),# m = 100),

test/unit_tests/data_input_formats.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using StructuralEquationModels, Test, Statistics
2-
import StructuralEquationModels: obs_cov, obs_mean, get_data
3-
2+
using StructuralEquationModels: obs_cov, obs_mean, get_data
43
### model specification --------------------------------------------------------------------
54

65
spec = ParameterTable(nothing)

0 commit comments

Comments
 (0)