def get_inchi_key(self): '''Returns inchi key''' structure = parsers.get_inchi_key(self.__chebi_id) if structure is None: structure = parsers.get_inchi_key(self.get_parent_id()) if structure is None: for parent_or_child_id in self.__get_all_ids(): structure = parsers.get_inchi_key(parent_or_child_id) if structure is not None: break return None if structure is None else structure.get_structure()
def test_get_inchi_key_neg_dim(self): '''COMMENT''' this_structure = Structure( 'VIDUVSPOWYVZIC-IMJSIDKUSA-O', Structure.InChIKey, 123456) self.assertNotEquals(this_structure, parsers.get_inchi_key(73938))
def test_get_inchi_key_neg_struct(self): '''COMMENT''' this_structure = Structure( 'made_up', Structure.InChIKey, 1) self.assertNotEquals(this_structure, parsers.get_inchi_key(73938))
def test_get_inchi_key_neg_type(self): '''COMMENT''' this_structure = Structure( 'VIDUVSPOWYVZIC-IMJSIDKUSA-O', Structure.mol, 1) self.assertNotEquals(this_structure, parsers.get_inchi_key(73938))
def test_get_inchi_key_neg(self): '''COMMENT''' self.assertIsNone(parsers.get_inchi_key(-1))
def test_get_inchi_key_missing(self): '''COMMENT''' self.assertIsNone(parsers.get_inchi_key(1))
def test_get_inchi_key_neg_dim(self): '''COMMENT''' this_structure = Structure('VIDUVSPOWYVZIC-IMJSIDKUSA-O', Structure.InChIKey, 123456) self.assertNotEquals(this_structure, parsers.get_inchi_key(73938))
def test_get_inchi_key_neg_type(self): '''COMMENT''' this_structure = Structure('VIDUVSPOWYVZIC-IMJSIDKUSA-O', Structure.mol, 1) self.assertNotEquals(this_structure, parsers.get_inchi_key(73938))
def test_get_inchi_key_neg_struct(self): '''COMMENT''' this_structure = Structure('made_up', Structure.InChIKey, 1) self.assertNotEquals(this_structure, parsers.get_inchi_key(73938))