22# -*- coding: utf-8 -*-
33
44import unittest
5+ from external .wip import work_in_progress
56
67from rmgpy .molecule .group import *
78from rmgpy .molecule .atomtype import atomTypes
@@ -153,7 +154,17 @@ def testEquivalent(self):
153154 else :
154155 self .assertFalse (atom1 .equivalent (atom2 ), '{0!s} is equivalent to {1!s}' .format (atom1 , atom2 ))
155156 self .assertFalse (atom2 .equivalent (atom1 ), '{0!s} is equivalent to {1!s}' .format (atom2 , atom1 ))
156-
157+ # Now see if charge and radical count are checked properly
158+ for charge in range (3 ):
159+ for radicals in range (2 ):
160+ atom3 = GroupAtom (atomType = [atomType1 ], radicalElectrons = [radicals ], spinMultiplicity = [radicals + 1 ], charge = [charge ], label = '*1' )
161+ if radicals == 1 and charge == 0 :
162+ self .assertTrue (atom1 .equivalent (atom3 ), '{0!s} is not equivalent to {1!s}' .format (atom1 , atom3 ))
163+ self .assertTrue (atom1 .equivalent (atom3 ), '{0!s} is not equivalent to {1!s}' .format (atom3 , atom1 ))
164+ else :
165+ self .assertFalse (atom1 .equivalent (atom3 ), '{0!s} is equivalent to {1!s}' .format (atom1 , atom3 ))
166+ self .assertFalse (atom1 .equivalent (atom3 ), '{0!s} is equivalent to {1!s}' .format (atom3 , atom1 ))
167+
157168 def testIsSpecificCaseOf (self ):
158169 """
159170 Test the GroupAtom.isSpecificCaseOf() method.
@@ -162,10 +173,17 @@ def testIsSpecificCaseOf(self):
162173 for label2 , atomType2 in atomTypes .iteritems ():
163174 atom1 = GroupAtom (atomType = [atomType1 ], radicalElectrons = [1 ], spinMultiplicity = [2 ], charge = [0 ], label = '*1' )
164175 atom2 = GroupAtom (atomType = [atomType2 ], radicalElectrons = [1 ], spinMultiplicity = [2 ], charge = [0 ], label = '*1' )
176+ # And make more generic types of these two atoms
177+ atom1gen = GroupAtom (atomType = [atomType1 ], radicalElectrons = [0 , 1 ], spinMultiplicity = [1 , 2 ], charge = [0 , 1 ], label = '*1' )
178+ atom2gen = GroupAtom (atomType = [atomType2 ], radicalElectrons = [0 , 1 ], spinMultiplicity = [1 , 2 ], charge = [0 , 1 ], label = '*1' )
165179 if label1 == label2 or atomType2 in atomType1 .generic :
166180 self .assertTrue (atom1 .isSpecificCaseOf (atom2 ), '{0!s} is not a specific case of {1!s}' .format (atom1 , atom2 ))
181+ self .assertTrue (atom1 .isSpecificCaseOf (atom2gen ), '{0!s} is not a specific case of {1!s}' .format (atom1 , atom2gen ))
182+ self .assertFalse (atom1gen .isSpecificCaseOf (atom2 ), '{0!s} is a specific case of {1!s}' .format (atom1gen , atom2 ))
167183 else :
168- self .assertFalse (atom1 .isSpecificCaseOf (atom2 ), '{0!s} is not a specific case of {1!s}' .format (atom1 , atom2 ))
184+ self .assertFalse (atom1 .isSpecificCaseOf (atom2 ), '{0!s} is a specific case of {1!s}' .format (atom1 , atom2 ))
185+ self .assertFalse (atom1 .isSpecificCaseOf (atom2gen ), '{0!s} is a specific case of {1!s}' .format (atom1 , atom2gen ))
186+ self .assertFalse (atom1gen .isSpecificCaseOf (atom2 ), '{0!s} is a specific case of {1!s}' .format (atom1gen , atom2 ))
169187
170188 def testCopy (self ):
171189 """
0 commit comments