@@ -129,6 +129,12 @@ def test_solvation(self):
129129 test .description = test_name
130130 self .compat_func_name = test_name
131131 yield test , group_name
132+
133+ test = lambda x : self .general_checkSiblingsForParents (group_name , group )
134+ test_name = "Solvation groups {0}: sibling relationships are correct?" .format (group_name )
135+ test .description = test_name
136+ self .compat_func_name = test_name
137+ yield test , group_name
132138
133139 def test_statmech (self ):
134140 for group_name , group in self .database .statmech .groups .iteritems ():
@@ -150,6 +156,12 @@ def test_statmech(self):
150156 self .compat_func_name = test_name
151157 yield test , group_name
152158
159+ test = lambda x : self .general_checkSiblingsForParents (group_name , group )
160+ test_name = "Statmech groups {0}: sibling relationships are correct?" .format (group_name )
161+ test .description = test_name
162+ self .compat_func_name = test_name
163+ yield test , group_name
164+
153165 def test_transport (self ):
154166 for group_name , group in self .database .transport .groups .iteritems ():
155167 test = lambda x : self .general_checkNodesFoundInTree (group_name , group )
@@ -169,6 +181,12 @@ def test_transport(self):
169181 test .description = test_name
170182 self .compat_func_name = test_name
171183 yield test , group_name
184+
185+ test = lambda x : self .general_checkSiblingsForParents (group_name , group )
186+ test_name = "Transport groups {0}: sibling relationships are correct?" .format (group_name )
187+ test .description = test_name
188+ self .compat_func_name = test_name
189+ yield test , group_name
172190
173191 # These are the actual tests, that don't start with a "test_" name:
174192 def kinetics_checkCorrectNumberofNodesInRules (self , family_name ):
@@ -259,6 +277,26 @@ def kinetics_checkChildParentRelationships(self, family_name):
259277 nose .tools .assert_true (family .matchNodeToChild (ancestorNode , childNode ),
260278 "In {family} family, group {ancestor} is not a proper ancestor of its child {child}." .format (family = family_name , ancestor = ancestorNode , child = nodeName ))
261279
280+ def kinetics__checkSiblingsForParents (self , family_name ):
281+ """
282+ This test checks that siblings in a tree are not actually parent/child
283+ """
284+ from rmgpy .data .base import Database
285+ originalFamily = self .database .kinetics .families [family_name ]
286+ family = Database ()
287+ family .entries = originalFamily .groups .entries
288+ for nodeName , node in family .entries .iteritems ():
289+ #Some families also construct a 2-level trees (root with all entries down one level)
290+ #We don't care about this tree as it is not used in searching, so we ignore products
291+ if node in family .forwardTemplate .products : continue
292+ for index , child1 in enumerate (node .children ):
293+ for child2 in node .children [index + 1 :]:
294+ #Don't check a node against itself
295+ if child1 is child2 : continue
296+ nose .tools .assert_false (family .matchNodeToChild (child1 , child2 ),
297+ "In {0} group, node {1} is written as a sibling of {2}, when it is actually a parent." .format (group_name , child1 , child2 ))
298+
299+
262300 def kinetics_checkAdjlistsNonidentical (self , database ):
263301 """
264302 This test checks whether adjacency lists of reactants in a KineticsDepository or KineticsLibrary database object are nonidentical.
0 commit comments