Skip to content

Commit

Permalink
Merge pull request #388 from willfurnass/tidy-unit-tests
Browse files Browse the repository at this point in the history
Unit tests: remove useless tests and tidy up the (only) two useful ones
  • Loading branch information
willfurnass authored Feb 16, 2020
2 parents acea5b4 + 6c36480 commit 0880bd8
Showing 1 changed file with 17 additions and 28 deletions.
45 changes: 17 additions & 28 deletions tests/test_all.py
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))

0 comments on commit 0880bd8

Please sign in to comment.