Skip to content

Commit 981fcf0

Browse files
committed
Update databaseTest.py to be the same as RMG-Py's, again...
It's poor form to have this file in both repos, but it's for the sake of RMG-tests. Maybe someone should remove it someday.
1 parent f3376ba commit 981fcf0

1 file changed

Lines changed: 17 additions & 11 deletions

File tree

testing/databaseTest.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,12 @@ def test_thermo(self):
116116
self.compat_func_name = test_name
117117
yield test, group_name
118118

119-
test = lambda x: self.general_checkSiblingsForParents(group_name, group)
120-
test_name = "Thermo groups {0}: sibling relationships are correct?".format(group_name)
121-
test.description = test_name
122-
self.compat_func_name = test_name
123-
yield test, group_name
119+
if group_name != 'polycyclic':
120+
test = lambda x: self.general_checkSiblingsForParents(group_name, group)
121+
test_name = "Thermo groups {0}: sibling relationships are correct?".format(group_name)
122+
test.description = test_name
123+
self.compat_func_name = test_name
124+
yield test, group_name
124125

125126
test = lambda x: self.general_checkCdAtomType(group_name, group)
126127
test_name = "Thermo groups {0}: Cd atomtype used correctly?".format(group_name)
@@ -298,6 +299,11 @@ def kinetics_checkChildParentRelationships(self, family_name):
298299
#top nodes and product nodes don't have parents by definition, so they get an automatic pass:
299300
if childNode in originalFamily.groups.top or childNode in originalFamily.forwardTemplate.products: continue
300301
parentNode = childNode.parent
302+
303+
if parentNode is None:
304+
# This is a mistake in the database, but it should be caught by kinetics_checkGroupsFoundInTree
305+
# so rather than report it twice or crash, we'll just silently carry on to the next node.
306+
continue
301307
# Check whether the node has proper parents unless it is the top reactant or product node
302308
# The parent should be more general than the child
303309
nose.tools.assert_true(family.matchNodeToChild(parentNode, childNode),
@@ -331,9 +337,9 @@ def kinetics_checkSiblingsForParents(self, family_name):
331337
#Don't check a node against itself
332338
if child1 is child2: continue
333339
nose.tools.assert_false(family.matchNodeToChild(child1, child2),
334-
"In family {0}, node {1} is written as a sibling of {2}, when it is actually a parent.".format(family_name, child1, child2))
340+
"In family {0}, node {1} is a parent of {2}, but they are written as siblings.".format(family_name, child1, child2))
335341
nose.tools.assert_false(family.matchNodeToChild(child2, child1),
336-
"In family {0}, node {1} is written as a sibling of {2}, when it is actually a parent.".format(family_name, child2, child1))
342+
"In family {0}, node {1} is a parent of {2}, but they are written as siblings.".format(family_name, child2, child1))
337343

338344
def kinetics_checkAdjlistsNonidentical(self, database):
339345
"""
@@ -429,7 +435,7 @@ def kinetics_checkCdAtomType(self, family_name):
429435
for correctAtom in correctAtomList:
430436
nose.tools.assert_true(atomTypes[correctAtom] in atom.atomType,
431437
"""In family {0}, node {1} is missing the atomtype {2} in atom {3} and may be misusing the atomtype Cd, CO, CS, or Cdd.
432-
The following adjList may be have atoms in a different ordering than the input file:
438+
The following adjList may have atoms in a different ordering than the input file:
433439
{4}
434440
""".format(family_name, entry, correctAtom, index+1, entry.item.toAdjacencyList()))
435441

@@ -496,9 +502,9 @@ def general_checkSiblingsForParents(self, group_name, group):
496502
#Don't check a node against itself
497503
if child1 is child2: continue
498504
nose.tools.assert_false(group.matchNodeToChild(child1, child2),
499-
"In {0} group, node {1} is written as a sibling of {2}, when it is actually a parent.".format(group_name, child1, child2))
505+
"In {0} group, node {1} is a parent of {2}, but they are written as siblings.".format(group_name, child1, child2))
500506
nose.tools.assert_false(group.matchNodeToChild(child2, child1),
501-
"In {0} group, node {1} is written as a sibling of {2}, when it is actually a parent.".format(group_name, child2, child1))
507+
"In {0} group, node {1} is a parent of {2}, but they are written as siblings.".format(group_name, child2, child1))
502508

503509
def general_checkCdAtomType(self, group_name, group):
504510
"""
@@ -536,7 +542,7 @@ def general_checkCdAtomType(self, group_name, group):
536542
for correctAtom in correctAtomList:
537543
nose.tools.assert_true(atomTypes[correctAtom] in atom.atomType,
538544
"""In group {0}, node {1} is missing the atomtype {2} in atom {3} and may be misusing the atomtype Cd, CO, CS, or Cdd.
539-
The following adjList may be have atoms in a different ordering than the input file:
545+
The following adjList may have atoms in a different ordering than the input file:
540546
{4}
541547
""".format(group_name, entry, correctAtom, index+1, entry.item.toAdjacencyList()))
542548

0 commit comments

Comments
 (0)