Пример #1
0
 def testRotorNumberHard(self):
     """Count the number of internal rotors in a tricky case"""
     test_set = [('CC', 1),   # start with something simple:    H3C---CH3
                 ('CC#CC', 1) # now lengthen that middle bond: H3C-C#C-CH3
                 ]
     fail_message = ''
     for smile,should_be in test_set:
         molecule = Molecule(SMILES=smile)
         rotorNumber = molecule.countInternalRotors()
         if rotorNumber!=should_be:
             fail_message+="Got rotor number of %s for %s (expected %s)\n"%(rotorNumber,smile,should_be)
     self.assertEqual(fail_message,'',fail_message)
Пример #2
0
 def testRotorNumber(self):
     """Count the number of internal rotors"""
     # http://cactus.nci.nih.gov/chemical/structure/C1CCCC1C/image
     test_set = [('CC', 1),
                 ('CCC', 2),
                 ('CC(C)(C)C', 4),
                 ('C1CCCC1C',1),
                 ('C=C',0)
                 ]
     fail_message = ''
     for smile,should_be in test_set:
         molecule = Molecule(SMILES=smile)
         rotorNumber = molecule.countInternalRotors()
         if rotorNumber!=should_be:
             fail_message+="Got rotor number of %s for %s (expected %s)\n"%(rotorNumber,smile,should_be)
     self.assertEqual(fail_message,'',fail_message)