def get_mol(self): '''Returns mol''' structure = parsers.get_mol(self.__chebi_id) if structure is None: structure = parsers.get_mol(self.get_parent_id()) if structure is None: for parent_or_child_id in self.__get_all_ids(): structure = parsers.get_mol(parent_or_child_id) if structure is not None: break return None if structure is None else structure.get_structure()
def __get_mol_id(self, chebi_id): '''COMMENT''' directory = os.path.dirname(os.path.realpath(__file__)) textfile_read = open(directory + '/ChEBI_' + str(chebi_id) + '.mol', 'r') mol_read = textfile_read.read() this_structure = Structure(mol_read, Structure.mol, 2) self.assertEquals(this_structure, parsers.get_mol(chebi_id))
def test_get_mol_neg(self): '''COMMENT''' self.assertIsNone(parsers.get_mol(-1))
def test_get_mol_missing(self): '''COMMENT''' self.assertIsNone(parsers.get_mol(1))