-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #388 from willfurnass/tidy-unit-tests
Unit tests: remove useless tests and tidy up the (only) two useful ones
- Loading branch information
Showing
1 changed file
with
17 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,27 @@ | ||
from textwrap import dedent | ||
import os | ||
|
||
from mumot.models import parseModel | ||
|
||
|
||
def test_dummy_1(): | ||
"""A brief description of this test. | ||
More information about this test. | ||
""" | ||
assert 1 == 1 | ||
|
||
|
||
def test_dummy_2(): | ||
"""A brief description of this test. | ||
More information about this test. | ||
""" | ||
assert 2 == 2 | ||
EXPRESSION_STRS = [ | ||
"U -> A : g_A", | ||
"U -> B : g_B", | ||
"A -> U : a_A", | ||
"B -> U : a_B", | ||
"A + U -> A + A : r_A", | ||
"B + U -> B + B : r_B", | ||
"A + B -> A + U : s", | ||
"A + B -> B + U : s"] | ||
|
||
|
||
def test_parse_model_from_cell_contents(): | ||
"""Assert we can instantiate a MuMoTmodel from the contents of a Notebook cell that uses the %%model cell magic.""" | ||
s = "get_ipython().run_cell_magic('model', '', '$\\nU -> A : g_A\\nU -> B : g_B\\nA -> U : a_A\\nB -> U : a_B\\nA + U -> A + A : r_A\\nB + U -> B + B : r_B\\nA + B -> A + U : s\\nA + B -> B + U : s\\n$\\n')" | ||
parseModel(s) | ||
"""Assert we can instantiate a MuMoTmodel from the contents of a Notebook | ||
cell that uses the %%model cell magic.""" | ||
parseModel(r"\n".join( | ||
["get_ipython().run_cell_magic('model', '', '$"] + | ||
EXPRESSION_STRS + | ||
["$", "')"])) | ||
|
||
|
||
def test_parse_model_from_str(): | ||
"""Assert we can instantiate a MuMoTmodel from a multi-line string.""" | ||
s = dedent("""U -> A : g_A | ||
U -> B : g_B | ||
A -> U : a_A | ||
B -> U : a_B | ||
A + U -> A + A : r_A | ||
B + U -> B + B : r_B | ||
A + B -> A + U : s | ||
A + B -> B + U : s""") | ||
parseModel(s) | ||
parseModel(os.linesep.join(EXPRESSION_STRS)) |