def test_gen_frag_has_no_empty_molecules(self): CS = cs(inchi = inchi1) CG = cg(CS.mol) for level in xrange(0, 4): frag = CG.gen_frag(level) nonempty_frag = filter(lambda f: len(f.chem_formula()) > 0, frag) self.assertEqual(frag, nonempty_frag)
def test_chem_formula(self): CS = cs(inchi = inchi1) CG = cg(CS.mol) self.assertEqual(CG.chem_formula(),CS.chem_formula())
def test_chem_graph_from_OBMol(self): CS = cs(inchi = inchi1) CG = cg(CS.mol) self.assertEqual(CG.G.number_of_nodes(), 16) self.assertEqual(CG.G.number_of_edges(), 17)
def test_chem_graph_with_empty_input(self): CG = cg() self.assertEqual(CG.G.number_of_nodes(), 0)
def test_gen_frag_with_additional_steps_uniqueness(self): CS = cs(inchi = inchi1) CG = cg(CS.mol) for level in range(1, 4): frag = CG.gen_frag(level) self.assertEqual(len(frag), len(set(frag)))
def test_gen_frag_with_no_additional_steps(self): CS = cs(inchi = inchi1) CG = cg(CS.mol) self.assertEqual(CG.gen_frag(0), [CG])
def test_mass(self): CS = cs(inchi = inchi1) CG = cg(CS.mol) self.assertTrue(abs(CG.mass() - CS.mass()) / CG.mass() < 0.001)