MCPcopy Index your code
hub / github.com/python/cpython / test_regular_templates

Method test_regular_templates

Lib/test/test_string/test_string.py:235–240  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

233
234class TestTemplate(unittest.TestCase):
235 def test_regular_templates(self):
236 s = Template('$who likes to eat a bag of $what worth $$100')
237 self.assertEqual(s.substitute(dict(who='tim', what='ham')),
238 'tim likes to eat a bag of ham worth $100')
239 self.assertRaises(KeyError, s.substitute, dict(who='tim'))
240 self.assertRaises(TypeError, Template.substitute)
241
242 def test_regular_templates_with_braces(self):
243 s = Template('$who likes ${what} for ${meal}')

Callers

nothing calls this directly

Calls 4

substituteMethod · 0.95
TemplateClass · 0.90
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected