Skip to content

Commit

Permalink
fix failing tests in test/reactionsystem.jl; put variables in testset…
Browse files Browse the repository at this point in the history
… scope
  • Loading branch information
paulflang committed Jun 1, 2021
1 parent dce53c3 commit 44d88f5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 22 deletions.
34 changes: 15 additions & 19 deletions test/reactionsystem.jl
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
using Catalyst, ModelingToolkit, OrdinaryDiffEq

sbmlfile = "reactionsystem_01.xml"

@parameters t, k1, c1
@variables s1, s2, s1s2

COMP1 = SBML.Compartment("c1", true, 3, 2., "nl")
SPECIES1 = SBML.Species("s1", "c1", false, nothing, nothing, (1., "substance"), nothing, true) # Todo: Maybe not support units in initial_concentration?
SPECIES2 = SBML.Species("s2", "c1", false, nothing, nothing, nothing, (1., "substance/nl"), false)
KINETICMATH1 = SBML.MathIdent("k1")
KINETICMATH2 = SBML.MathApply("*", SBML.Math[
SBML.MathIdent("k1"), SBML.MathIdent("s2")])
REACTION1 = SBML.Reaction(Dict("s1" => 1), nothing, nothing, nothing, nothing, KINETICMATH1, false)
REACTION2 = SBML.Reaction(Dict("s2" => -1), nothing, nothing, nothing, nothing, KINETICMATH2, false)
MODEL1 = SBML.Model(Dict("k1" => 1.), Dict(), Dict("c1" => COMP1), Dict("s1" => SPECIES1), Dict("r1" => REACTION1), nothing, nothing) # PL: For instance in the compartments dict, we may want to enforce that key and compartment.name are identical
MODEL2 = SBML.Model(Dict("k1" => 1.), Dict(), Dict("c1" => COMP1), Dict("s2" => SPECIES2), Dict("r2" => REACTION2), nothing, nothing)


@testset "Model to MTK conversions" begin

sbmlfile = "reactionsystem_01.xml"
@parameters t, k1, c1
@variables s1, s2, s1s2

COMP1 = SBML.Compartment("c1", true, 3, 2., "nl")
SPECIES1 = SBML.Species("s1", "c1", false, nothing, nothing, (1., "substance"), nothing, true) # Todo: Maybe not support units in initial_concentration?
SPECIES2 = SBML.Species("s2", "c1", false, nothing, nothing, nothing, (1., "substance/nl"), false)
KINETICMATH1 = SBML.MathIdent("k1")
KINETICMATH2 = SBML.MathApply("*", SBML.Math[
SBML.MathIdent("k1"), SBML.MathIdent("s2")])
REACTION1 = SBML.Reaction(Dict("s1" => 1), nothing, nothing, nothing, nothing, KINETICMATH1, false)
REACTION2 = SBML.Reaction(Dict("s2" => -1), nothing, nothing, nothing, nothing, KINETICMATH2, false)
MODEL1 = SBML.Model(Dict("k1" => 1.), Dict(), Dict("c1" => COMP1), Dict("s1" => SPECIES1), Dict("r1" => REACTION1), Dict(), Dict()) # PL: For instance in the compartments dict, we may want to enforce that key and compartment.name are identical
MODEL2 = SBML.Model(Dict("k1" => 1.), Dict(), Dict("c1" => COMP1), Dict("s2" => SPECIES2), Dict("r2" => REACTION2), Dict(), Dict())

# Test ReactionSystem constructor
rs = ReactionSystem(MODEL1)
Expand Down
6 changes: 3 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ModelingToolkit
using Catalyst, ModelingToolkit, OrdinaryDiffEq
using Test, SHA, SparseArrays
using SBML
using SBML: Model, Reaction, Species
Expand All @@ -9,6 +9,6 @@ import Pkg
# include("ecoli_flux.jl")
# include("loadmodels.jl")
# include("sbml2symbolics.jl")
# include("reactionsystem.jl")
include("loaddynamicmodels.jl")
include("reactionsystem.jl")
# include("loaddynamicmodels.jl")
end

0 comments on commit 44d88f5

Please sign in to comment.