Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,18 @@
master_doc = 'index'

# General information about the project.
project = u'TRuML'
copyright = u'2017, Ryan Suderman'
author = u'Ryan Suderman'
project = 'TRuML'
copyright = '2017, Ryan Suderman'
author = 'Ryan Suderman'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = u'0.1.0'
version = '0.1.0'
# The full version, including alpha/beta/rc tags.
release = u'0.1.0'
release = '0.1.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down Expand Up @@ -141,8 +141,8 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'TRuML.tex', u'TRuML Documentation',
u'Ryan Suderman', 'manual'),
(master_doc, 'TRuML.tex', 'TRuML Documentation',
'Ryan Suderman', 'manual'),
]


Expand All @@ -151,7 +151,7 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'truml', u'TRuML Documentation',
(master_doc, 'truml', 'TRuML Documentation',
[author], 1)
]

Expand All @@ -162,7 +162,7 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'TRuML', u'TRuML Documentation',
(master_doc, 'TRuML', 'TRuML Documentation',
author, 'TRuML', 'One line description of project.',
'Miscellaneous'),
]
Expand Down
6 changes: 3 additions & 3 deletions tests/test_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,22 +67,22 @@ def test_interface_map(self):
idm0 = self.m7.interface_diff_map(self.m9)
assert len(idm0) == 1
s0 = objects.Site('a', 1)
assert s0 in idm0.keys()
assert s0 in list(idm0.keys())
assert idm0[s0] == (-1, objects.Bond(1))

def test_build_mol_map(self):
r0_lhs_mols = utils.flatten_pattern([self.p2])
r0_rhs_mols = utils.flatten_pattern([self.p3])
mmap0 = objects.Rule._build_mol_map(r0_lhs_mols, r0_rhs_mols)
assert mmap0[0] is None
assert len(mmap0.keys()) == 1
assert len(list(mmap0.keys())) == 1

r1_lhs_mols = utils.flatten_pattern([self.p5, self.p6])
r1_rhs_mols = utils.flatten_pattern([self.p7])
mmap1 = objects.Rule._build_mol_map(r1_lhs_mols, r1_rhs_mols)
assert mmap1[0] == 0
assert mmap1[1] == 1
assert len(mmap1.keys()) == 2
assert len(list(mmap1.keys())) == 2

r2_lhs_mols = utils.flatten_pattern([self.p4, self.p2, self.p3])
r2_rhs_mols = utils.flatten_pattern([self.p4, self.p3])
Expand Down
8 changes: 5 additions & 3 deletions tests/test_convert.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from .context import readers
import os


class TestConvert:
Expand All @@ -7,8 +8,9 @@ def __init__(self):

@classmethod
def setup_class(cls):
test0 = "resources/test0.bngl"
test1 = "resources/test1.bngl"
testdir = os.path.abspath(os.path.dirname(__file__))
test0 = os.path.join(testdir, "resources/test0.bngl")
test1 = os.path.join(testdir, "resources/test1.bngl")
cls.bm0 = readers.BNGLReader(test0).parse()
cls.bm1 = readers.BNGLReader(test1).parse()

Expand Down Expand Up @@ -37,5 +39,5 @@ def test_bmodel0_convert(self):

def test_bmodel1_convert(self):
krules = [r for rule in self.bm1.rules for r in rule.convert()]
print '\n'.join([r.write_as_kappa() for r in krules])
print('\n'.join([r.write_as_kappa() for r in krules]))
assert len(krules) == 29
6 changes: 3 additions & 3 deletions tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def test_graph_builder(self):
graph = readers.BNGLReader.parse_cpattern(self.pattern, [self.md0, self.md1])._build_graph()
assert len(graph.nodes()) == 3
assert len(graph.edges()) == 2
assert graph.node[1]['name'] == 'A:xb_yb'
assert graph.nodes[1]['name'] == 'A:xb_yb'
assert graph[0][1]['name'] == 'x-x'

graph2 = readers.BNGLReader.parse_cpattern(self.pattern2, [self.md2, self.md3])._build_graph()
Expand Down Expand Up @@ -129,7 +129,7 @@ def test_contains_variable(self):
assert self.rate2.contains_variable('rate')

def test_factors(self):
print self.rule6._unique_reactant_indices()
print(self.rule6._unique_reactant_indices())
assert self.rule6._unique_reactant_indices() == {0: 2}
assert self.rule6.rate_factor(True) == 0.5
assert self.rule6.rate_factor(False) == 2.0
assert self.rule6.rate_factor(False) == 2.0
8 changes: 4 additions & 4 deletions tests/test_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,20 @@ def test_rule_parse(self):
assert len(rule4s) == 1
assert rule4s[0].rev
rule5s = readers.KappaReader.parse_rule(self.rule5, mds)
print rule5s[0]
print(rule5s[0])
assert len(rule5s[0].lhs) == 1
assert len(rule5s[0].lhs[0]) == 1
assert rule5s[0].lhs[0][0] == objects.PlaceHolderMolecule()
assert rule5s[0].rev
rule6s = readers.KappaReader.parse_rule(self.rule6, mds)
print rule6s
print(rule6s)
assert len(rule6s[0].rhs) == 1
assert len(rule6s[0].rhs[0]) == 1
assert rule6s[0].rhs[0][0] == objects.PlaceHolderMolecule()
assert rule6s[0].delmol
rule7s = readers.KappaReader.parse_rule(self.rule7, mds)
assert len(rule7s[0].rhs) == 2
print rule7s[0].rhs
print(rule7s[0].rhs)
assert isinstance(rule7s[0].rhs[1][0], objects.PlaceHolderMolecule)

def test_cpattern_parse(self):
Expand Down Expand Up @@ -200,7 +200,7 @@ def test_mol_parse(self):
assert mol1.write_as_bngl() == "Mol(a,b~U,b~P)"
mol2 = readers.BNGLReader.parse_molecule(self.mol2, [pmdef3])
assert mol2.write_as_bngl() == "Mol(a,b~?!+)"
print mol2.write_as_kappa()
print(mol2.write_as_kappa())
assert mol2.write_as_kappa() == "Mol(a[.],b{#}[_])"

@raises(rbexceptions.NotAMoleculeException)
Expand Down
5 changes: 3 additions & 2 deletions tests/test_print.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ def test_rule(self):
assert self.rule6.write_as_kappa() == r"B(b[.]),B(b[.]) -> B(b[1]),B(b[1]) @ 3 * 0.5"
assert self.rule6.write_as_bngl() == r"B(b)+B(b) -> B(b!1).B(b!1) 3 * 2.0"
assert self.rule6.write_as_bngl(dot=True) == r"B(b).B(b) -> B(b!1).B(b!1) 3 * 2.0"
print(self.rule7.write_as_kappa())
assert self.rule7.write_as_kappa() == r"B(b[1]),B(b[1]) -> B(b[.]),. @ 3 * 0.5"
assert self.rule7.write_as_bngl() == r"B(b!1).B(b!1) -> B(b) 3 * 2.0"
assert self.rule8.write_as_bngl() == r"B(b) -> B(b)+B(b) 3"
Expand All @@ -218,9 +219,9 @@ def test_molecule_conversion_determinism(self):
assert x[i - 1] < x[i]

def test_rule_expansion(self):
print self.rule3.write_as_bngl(from_bngl=True)
print(self.rule3.write_as_bngl(from_bngl=True))
x = self.rule3.convert()
print '\n'.join(sorted([y.write_as_kappa() for y in set(x)]))
print('\n'.join(sorted([y.write_as_kappa() for y in set(x)])))
assert len(x) == 36

def test_obs(self):
Expand Down
Loading