def test_atom_mapping_2(self):
    'Test that to_rdkit_mol returns correct indices and atom mappings when hydrogens are removed.'
    adjlist = '\n1 H u0 p0 c0 {2,S}\n2 C u0 p0 c0 {1,S} {3,S} {4,S} {5,S}\n3 H u0 p0 c0 {2,S}\n4 H u0 p0 c0 {2,S}\n5 O u0 p2 c0 {2,S} {6,S}\n6 H u0 p0 c0 {5,S}\n        '
    mol = Molecule().from_adjacency_list(adjlist)
    (rdkitmol, rd_atom_indices) = to_rdkit_mol(mol, remove_h=True, return_mapping=True)
    heavy_atoms = [at for at in mol.atoms if (at.number != 1)]
    for at1 in heavy_atoms:
        for at2 in heavy_atoms:
            if mol.has_bond(at1, at2):
                try:
                    rdkitmol.GetBondBetweenAtoms(rd_atom_indices[at1], rd_atom_indices[at2])
                except RuntimeError:
                    self.fail('RDKit failed in finding the bond in the original atom!')
Test that to_rdkit_mol returns correct indices and atom mappings when hydrogens are removed.
def test_atom_mapping_2(self):
    
    adjlist = '\n1 H u0 p0 c0 {2,S}\n2 C u0 p0 c0 {1,S} {3,S} {4,S} {5,S}\n3 H u0 p0 c0 {2,S}\n4 H u0 p0 c0 {2,S}\n5 O u0 p2 c0 {2,S} {6,S}\n6 H u0 p0 c0 {5,S}\n        '
    mol = Molecule().from_adjacency_list(adjlist)
    (rdkitmol, rd_atom_indices) = to_rdkit_mol(mol, remove_h=True, return_mapping=True)
    heavy_atoms = [at for at in mol.atoms if (at.number != 1)]
    for at1 in heavy_atoms:
        for at2 in heavy_atoms:
            if mol.has_bond(at1, at2):
                try:
                    rdkitmol.GetBondBetweenAtoms(rd_atom_indices[at1], rd_atom_indices[at2])
                except RuntimeError:
                    self.fail('RDKit failed in finding the bond in the original atom!')