def test_cloning(self):
     csmile = "[H][C](=[O])[C]([H])([H])[C]([H])([H])[H]"
     compound = Compound(csmile)
     cloned_compound = compound.clone()
     different_python_object = (id(compound) != id(cloned_compound))
     identical_chemical_object = (compound.eq_full_inchi_key(cloned_compound))
     assert (different_python_object and identical_chemical_object)
 def test_unstandardised_pickle(self):
     csmile = "C(=O)CC"
     compound = Compound(csmile)
     compound.save("test", folder_address = "tests/generated_jsons/pickles")
     loaded = unpickle("test", folder_address = "tests/generated_jsons/pickles")
     assert compound.eq_full_inchi_key(loaded)
 def test_simple_pickle(self):
     csmile = "[H][C](=[O])[C]([H])([H])[C]([H])([H])[H]"
     compound = Compound(csmile)
     compound.save("test", folder_address = "tests/generated_jsons/pickles")
     loaded = unpickle("test", folder_address = "tests/generated_jsons/pickles")
     assert compound.eq_full_inchi_key(loaded)
 def test_rdmol_import(self):
     ethylene_glycol = Compound(InChI = "InChI=1S/C2H6O2/c3-1-2-4/h3-4H,1-2H2")
     mol_file = Chem.inchi.MolFromInchi("InChI=1S/C2H6O2/c3-1-2-4/h3-4H,1-2H2", sanitize=False)
     mol_file = standardize_chemical(mol_file)
     ethylene_glycol_bis = Compound(rdkit_obj = mol_file)
     assert(ethylene_glycol.eq_full_inchi_key(ethylene_glycol_bis))
 def test_equality_full_layer(self):
     csmile = "[H][C](=[O])[C]([H])([H])[C]([H])([H])[H]"
     compound = Compound(csmile)
     compound_bis = Compound(csmile)
     assert compound.eq_full_inchi_key(compound_bis)
Exemple #6
0
 def test_set_up_as_smiles(self):
     csmile = "[H][C](=[O])[C]([H])([H])[C]([H])([H])[H]"
     compound = Compound(csmile)
     state = ChemicalCompoundState(csmile)
     assert compound.eq_full_inchi_key(state.compound_list[0])