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

Method test_idpattern_override

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

Source from the content-addressed store, hash-verified

315 raises(ValueError, s.substitute, dict(who='tim'))
316
317 def test_idpattern_override(self):
318 class PathPattern(Template):
319 idpattern = r'[_a-z][._a-z0-9]*'
320 m = Mapping()
321 m.bag = Bag()
322 m.bag.foo = Bag()
323 m.bag.foo.who = 'tim'
324 m.bag.what = 'ham'
325 s = PathPattern('$bag.foo.who likes to eat a bag of $bag.what')
326 self.assertEqual(s.substitute(m), 'tim likes to eat a bag of ham')
327
328 def test_flags_override(self):
329 class MyPattern(Template):

Callers

nothing calls this directly

Calls 5

PathPatternClass · 0.85
substituteMethod · 0.80
MappingClass · 0.70
BagClass · 0.70
assertEqualMethod · 0.45

Tested by

no test coverage detected