Lines Matching refs:substitute
211 self.assertEqual(s.substitute(dict(who='tim', what='ham')),
213 self.assertRaises(KeyError, s.substitute, dict(who='tim'))
214 self.assertRaises(TypeError, Template.substitute)
219 self.assertEqual(s.substitute(d), 'tim likes ham for dinner')
220 self.assertRaises(KeyError, s.substitute,
226 eq(s.substitute(dict(who='tim', what='ham')),
229 eq(s.substitute(dict(who='tim', what='ham')), 'tim likes $')
235 eq(s.substitute(d), '%(foo)s baz baz')
242 eq(s.substitute(d), 'tim has eaten 7 bags of ham today')
245 eq(s.substitute(d), 'tim has eaten 7 bags of ham today')
251 eq(s.substitute(d), "('tim', 'fred') ate ('ham', 'kung pao')")
269 raises(ValueError, s.substitute, dict(who='tim'))
271 raises(ValueError, s.substitute, dict(who='tim'))
273 raises(ValueError, s.substitute, dict(who='tim'))
284 self.assertEqual(s.substitute(m), 'tim likes to eat a bag of ham')
300 self.assertEqual(s.substitute(m), 'tim likes to eat a bag of ham')
311 self.assertRaises(ValueError, s.substitute, {})
327 self.assertRaises(KeyError, t.substitute, {})
328 val = t.substitute({'location': 'Cleveland'})
365 s.substitute({})
371 self.assertEqual(s.substitute(d), 't\xffm likes f\xfe\x0ced')
376 eq(s.substitute(who='tim', what='ham'), 'tim likes ham')
377 eq(s.substitute(dict(who='tim'), what='ham'), 'tim likes ham')
378 eq(s.substitute(dict(who='fred', what='kung pao'),
382 eq(s.substitute(dict(foo='none'), mapping='bozo'),
384 eq(s.substitute(dict(mapping='one'), mapping='two'),
388 eq(s.substitute(self='bozo'), 'the self is bozo')
405 raises(TypeError, s.substitute, d, {})
417 eq(s.substitute(gift='bud', who='you'), 'this bud is for you &')
418 raises(KeyError, s.substitute)
422 raises(ValueError, s.substitute, dict(gift='bud', who='you'))
428 self.assertEqual(s.substitute(dict(who='tim', what='ham')),