Skip to content

Commit 3d5fdd8

Browse files
test: isolate tests into new testset
1 parent 508cd8a commit 3d5fdd8

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

test/odesystem.jl

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -578,11 +578,6 @@ obsfn = ModelingToolkit.build_explicit_observed_function(
578578
outersys, bar(3outersys.sys.ms, 3outersys.sys.p))
579579
@test_nowarn obsfn(sol.u[1], prob.p, sol.t[1])
580580

581-
@testset "Observed Function: Expression" begin
582-
obsfn_expr = ModelingToolkit.build_explicit_observed_function(
583-
outersys, bar(3outersys.sys.ms, 3outersys.sys.p), expression = true)
584-
@test obsfn_expr isa Expr
585-
end
586581
# x/x
587582
@variables x(t)
588583
@named sys = ODESystem([D(x) ~ x / x], t)
@@ -1230,13 +1225,6 @@ end
12301225
buffer = zeros(3)
12311226
@test_nowarn obsfn(buffer, [1.0], ps, 3.0)
12321227
@test buffer [2.0, 3.0, 4.0]
1233-
1234-
@testset "Observed Function: Expression" begin
1235-
obsfn_expr_oop, obsfn_expr_iip = ModelingToolkit.build_explicit_observed_function(
1236-
sys, [x + 1, x + P, x + t], return_inplace = true, expression = true)
1237-
@test obsfn_expr_oop isa Expr
1238-
@test obsfn_expr_iip isa Expr
1239-
end
12401228
end
12411229

12421230
# https://github.com/SciML/ModelingToolkit.jl/issues/2818
@@ -1736,3 +1724,15 @@ end
17361724
@mtkbuild ode = ODESystem(D(x(t)) ~ mat * x(t), t; constraints = cons)
17371725
@test length(constraints(ModelingToolkit.get_constraintsystem(ode))) == 5
17381726
end
1727+
1728+
@testset "`build_explicit_observed_function` with `expression = true` returns `Expr`" begin
1729+
@variables x(t)
1730+
@mtkbuild sys = ODESystem(D(x) ~ 2x, t)
1731+
obsfn_expr = ModelingToolkit.build_explicit_observed_function(
1732+
sys, 2x + 1, expression = true)
1733+
@test obsfn_expr isa Expr
1734+
obsfn_expr_oop, obsfn_expr_iip = ModelingToolkit.build_explicit_observed_function(
1735+
sys, [x + 1, x + 2, x + t], return_inplace = true, expression = true)
1736+
@test obsfn_expr_oop isa Expr
1737+
@test obsfn_expr_iip isa Expr
1738+
end

0 commit comments

Comments
 (0)