def METHOD_NAME(self):
    eq = self.assertEqual
    raises = self.assertRaises
    class AmpersandTemplate(Template):
        delimiter = '&'
    s = AmpersandTemplate('this &gift is for &{who} &&')
    eq(s.substitute(gift='bud', who='you'), 'this bud is for you &')
    raises(KeyError, s.substitute)
    eq(s.safe_substitute(gift='bud', who='you'), 'this bud is for you &')
    eq(s.safe_substitute(), 'this &gift is for &{who} &')
    s = AmpersandTemplate('this &gift is for &{who} &')
    raises(ValueError, s.substitute, dict(gift='bud', who='you'))
    eq(s.safe_substitute(), 'this &gift is for &{who} &')
    class PieDelims(Template):
        delimiter = '@'
    s = PieDelims('@who likes to eat a bag of @{what} worth $100')
    self.assertEqual(s.substitute(dict(who='tim', what='ham')),
                     'tim likes to eat a bag of ham worth $100')