Menu

#671 Calling OBSmarts.GetUMapList affects GetMapList

2.3.x
open
nobody
5
2012-10-23
2010-11-11
No

From Andrew Dalke:

It seems that GetUMapList interacts with the results of GetMapList.

def test_basic_match_behavior_which_I_did_not_expect(self):
mol = parse_smiles("c1ccccc1O")
pat = parse_smarts("c1ccccc1")
pat.Match(mol)
self.assertEquals(pat.NumMatches(), 12)
results = pat.GetUMapList()
self.assertEquals(pat.NumMatches(), 1)
results = pat.GetMapList()
# I really expected the following to be 12.
# It appears the UMapList does an in-place trim.
# XXX Is that the right/expected behavior?
self.assertEquals(pat.NumMatches(), 1)
self.assertEquals(len(results), 1)

   pat.Match(mol)
   # Here they are 12
   results = pat.GetMapList()
   self.assertEquals(pat.NumMatches(), 12)
   results = pat.GetUMapList()
   self.assertEquals(pat.NumMatches(), 1)
   self.assertEquals(len(results), 1)

Discussion