def test_atom_mapping_1(self):
    'Test that to_rdkit_mol returns correct indices and atom mappings.'
    bond_order_dict = {'SINGLE': 1, 'DOUBLE': 2, 'TRIPLE': 3, 'AROMATIC': 1.5}
    mol = Molecule().from_smiles('C1CCC=C1C=O')
    (rdkitmol, rd_atom_indices) = to_rdkit_mol(mol, remove_h=False, return_mapping=True)
    for atom in mol.atoms:
        self.assertTrue((atom in rd_atom_indices))
        for (connected_atom, bond) in atom.bonds.items():
            bond_type = str(rdkitmol.GetBondBetweenAtoms(rd_atom_indices[atom], rd_atom_indices[connected_atom]).GetBondType())
            rdkit_bond_order = bond_order_dict[bond_type]
            self.assertEqual(bond.order, rdkit_bond_order)
    (rdkitmol2, rd_atom_indices2) = to_rdkit_mol(mol, remove_h=True, return_mapping=True)
    for atom in mol.atoms:
        if (atom.symbol != 'H'):
            self.assertTrue((atom in rd_atom_indices2))
            for (connected_atom, bond) in atom.bonds.items():
                if (connected_atom.symbol != 'H'):
                    bond_type = str(rdkitmol2.GetBondBetweenAtoms(rd_atom_indices2[atom], rd_atom_indices2[connected_atom]).GetBondType())
                    rdkit_bond_order = bond_order_dict[bond_type]
                    self.assertEqual(bond.order, rdkit_bond_order)
Test that to_rdkit_mol returns correct indices and atom mappings.
def test_atom_mapping_1(self):
    
    bond_order_dict = {'SINGLE': 1, 'DOUBLE': 2, 'TRIPLE': 3, 'AROMATIC': 1.5}
    mol = Molecule().from_smiles('C1CCC=C1C=O')
    (rdkitmol, rd_atom_indices) = to_rdkit_mol(mol, remove_h=False, return_mapping=True)
    for atom in mol.atoms:
        self.assertTrue((atom in rd_atom_indices))
        for (connected_atom, bond) in atom.bonds.items():
            bond_type = str(rdkitmol.GetBondBetweenAtoms(rd_atom_indices[atom], rd_atom_indices[connected_atom]).GetBondType())
            rdkit_bond_order = bond_order_dict[bond_type]
            self.assertEqual(bond.order, rdkit_bond_order)
    (rdkitmol2, rd_atom_indices2) = to_rdkit_mol(mol, remove_h=True, return_mapping=True)
    for atom in mol.atoms:
        if (atom.symbol != 'H'):
            self.assertTrue((atom in rd_atom_indices2))
            for (connected_atom, bond) in atom.bonds.items():
                if (connected_atom.symbol != 'H'):
                    bond_type = str(rdkitmol2.GetBondBetweenAtoms(rd_atom_indices2[atom], rd_atom_indices2[connected_atom]).GetBondType())
                    rdkit_bond_order = bond_order_dict[bond_type]
                    self.assertEqual(bond.order, rdkit_bond_order)