Skip to content

Commit

Permalink
fix Dasgupta model testing
Browse files Browse the repository at this point in the history
  • Loading branch information
exaexa committed Dec 11, 2023
1 parent 25af259 commit d9d0cf7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
4 changes: 2 additions & 2 deletions test/data/Dasgupta2020-written.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<sbml xmlns="http://www.sbml.org/sbml/level3/version2/core" xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" level="3" version="2" fbc:required="false">
<model metaid="COPASI0" id="Dasgupta2020___Reduced_model_of_receptor_clusturing_and_aggregation" name="Dasgupta2020 - Reduced model of receptor clusturing and aggregation" fbc:strict="true">
<sbml xmlns="http://www.sbml.org/sbml/level3/version2/core" level="3" version="2">
<model metaid="COPASI0" id="Dasgupta2020___Reduced_model_of_receptor_clusturing_and_aggregation" name="Dasgupta2020 - Reduced model of receptor clusturing and aggregation">
<notes>
<body xmlns="http://www.w3.org/1999/xhtml">
<p>a simple kinetic mass-action-law-based model could be utilized to adequately describe clustering in
Expand Down
28 changes: 15 additions & 13 deletions test/writemodels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,22 @@ function remove_some_annotation_strings!(model::SBML.Model)
end

@testset "writeSBML" begin
model = readSBML(joinpath(@__DIR__, "data", "Dasgupta2020.xml"))
fix_constant!(model)
# uncomment the following line to re-create reference XML
# writeSBML(model,joinpath(@__DIR__, "data", "Dasgupta2020-written.xml"))
expected = read(joinpath(@__DIR__, "data", "Dasgupta2020-written.xml"), String)
# Remove carriage returns, if any
expected = replace(expected, '\r' => "")
@test @test_logs(writeSBML(model)) == expected
mktemp() do filename, _
@test_logs(writeSBML(model, filename))
content = read(filename, String)
@testset "Model Dasgupta2020.xml writes out as expected" begin
model = readSBML(joinpath(@__DIR__, "data", "Dasgupta2020.xml"))
fix_constant!(model)
# uncomment the following line to re-create reference XML
#writeSBML(model, joinpath(@__DIR__, "data", "Dasgupta2020-debug.xml"))
expected = read(joinpath(@__DIR__, "data", "Dasgupta2020-written.xml"), String)
# Remove carriage returns, if any
content = replace(content, '\r' => "")
@test content == expected
expected = replace(expected, '\r' => "")
@test @test_logs(writeSBML(model)) == expected
mktemp() do filename, _
@test_logs(writeSBML(model, filename))
content = read(filename, String)
# Remove carriage returns, if any
content = replace(content, '\r' => "")
@test content == expected
end
end

# Make sure that the model we read from the written out file is consistent
Expand Down

0 comments on commit d9d0cf7

Please sign in to comment.