def METHOD_NAME(self):
    class PathPattern(Template):
        idpattern = r'[_a-z][._a-z0-9]*'
    m = Mapping()
    m.bag = Bag()
    m.bag.foo = Bag()
    m.bag.foo.who = 'tim'
    m.bag.what = 'ham'
    s = PathPattern('$bag.foo.who likes to eat a bag of $bag.what')
    self.assertEqual(s.substitute(m), 'tim likes to eat a bag of ham')