def testIsInCycleCyclohexane(self): """ Test the Molecule.isInCycle() method with ethane. """ molecule = Molecule().fromInChI('InChI=1/C6H12/c1-2-4-6-5-3-1/h1-6H2') for atom in molecule.atoms: if atom.isHydrogen(): self.assertFalse(molecule.isAtomInCycle(atom)) elif atom.isCarbon(): self.assertTrue(molecule.isAtomInCycle(atom)) for atom1 in molecule.atoms: for atom2, bond in atom1.bonds.items(): if atom1.isCarbon() and atom2.isCarbon(): self.assertTrue(molecule.isBondInCycle(bond)) else: self.assertFalse(molecule.isBondInCycle(bond))
def testIsInCycleEthane(self): """ Test the Molecule.isInCycle() method with ethane. """ molecule = Molecule().fromSMILES('CC') for atom in molecule.atoms: self.assertFalse(molecule.isAtomInCycle(atom)) for atom1 in molecule.atoms: for atom2, bond in atom1.bonds.items(): self.assertFalse(molecule.isBondInCycle(bond))