Commit e2ad1a45 authored by VIGNET Pierre's avatar VIGNET Pierre
Browse files

[tests] Fix broken test; see more

- Test preamble presence
- Transitions are written in unpredictable order => use a set
- Add doc
parent 93063634
......@@ -18,7 +18,8 @@ def feed_model_with_SCC():
scc = [['I', 'K', 'J', 'L'], ['Y', 'X', 'Z']]
model = """<model xmlns="http://cadbiom" name="">
model = """<?xml version = "1.0" encoding="ASCII" standalone="yes" ?>
<model xmlns="http://cadbiom" name="">
<CSimpleNode name="A" xloc="0.0" yloc="0.0"/>
<CSimpleNode name="B" xloc="0.0" yloc="0.0"/>
<CSimpleNode name="E" xloc="0.0" yloc="0.0"/>
......@@ -57,7 +58,16 @@ def feed_model_with_SCC():
def test_SCC_search(feed_model_with_SCC):
"""Test the correction of a model by removing Strongly Connected Components
- We add a start node for every SCC
- We add a transition between the start node and the smallest node of every
SCC (sorted in lexicogrpahic order)
- Thus, we add xml preamble in the model
Keep in mind that by testing the result of the export of a model, we also
test its content...
import cadbiom.models.guard_transitions.analyser.model_corrections as mc
......@@ -104,5 +114,8 @@ def test_SCC_search(feed_model_with_SCC):
# Make a new model file (with "_without_scc" suffix in filename)
mc.add_start_nodes( # Filename + path
expected_lines = set(model.split("\n"))
with open([:-4] + "_without_scc.bcx", 'r') as file:
assert model ==
found_lines = set("\n"))
assert found_lines == expected_lines
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment