Lines Matching refs:substitute

210         self.assertEqual(s.substitute(dict(who='tim', what='ham')),
212 self.assertRaises(KeyError, s.substitute, dict(who='tim'))
213 self.assertRaises(TypeError, Template.substitute)
218 self.assertEqual(s.substitute(d), 'tim likes ham for dinner')
219 self.assertRaises(KeyError, s.substitute,
225 self.assertEqual(s.substitute(d), 'tim likes ham for dinner')
230 self.assertEqual(s.substitute(d), 'tim likes ham for dinner')
235 eq(s.substitute(dict(who='tim', what='ham')),
238 eq(s.substitute(dict(who='tim', what='ham')), 'tim likes $')
244 eq(s.substitute(d), '%(foo)s baz baz')
251 eq(s.substitute(d), 'tim has eaten 7 bags of ham today')
254 eq(s.substitute(d), 'tim has eaten 7 bags of ham today')
260 eq(s.substitute(d), "('tim', 'fred') ate ('ham', 'kung pao')")
278 raises(ValueError, s.substitute, dict(who='tim'))
280 raises(ValueError, s.substitute, dict(who='tim'))
282 raises(ValueError, s.substitute, dict(who='tim'))
286 raises(ValueError, s.substitute, dict(who='tim'))
288 raises(ValueError, s.substitute, dict(who='tim'))
299 self.assertEqual(s.substitute(m), 'tim likes to eat a bag of ham')
306 self.assertRaises(ValueError, s.substitute, d)
318 self.assertEqual(s.substitute(m), 'foo BAR')
329 self.assertRaises(ValueError, s.substitute, m)
331 self.assertRaises(ValueError, s.substitute, m)
347 self.assertEqual(s.substitute(m), 'tim likes to eat a bag of ham')
358 self.assertRaises(ValueError, s.substitute, {})
374 self.assertRaises(KeyError, t.substitute, {})
375 val = t.substitute({'location': 'Cleveland'})
412 s.substitute({})
418 self.assertEqual(s.substitute(d), 't\xffm likes f\xfe\x0ced')
423 eq(s.substitute(who='tim', what='ham'), 'tim likes ham')
424 eq(s.substitute(dict(who='tim'), what='ham'), 'tim likes ham')
425 eq(s.substitute(dict(who='fred', what='kung pao'),
429 eq(s.substitute(dict(foo='none'), mapping='bozo'),
431 eq(s.substitute(dict(mapping='one'), mapping='two'),
435 eq(s.substitute(self='bozo'), 'the self is bozo')
452 raises(TypeError, s.substitute, d, {})
464 eq(s.substitute(gift='bud', who='you'), 'this bud is for you &')
465 raises(KeyError, s.substitute)
469 raises(ValueError, s.substitute, dict(gift='bud', who='you'))
475 self.assertEqual(s.substitute(dict(who='tim', what='ham')),