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

Method test_flags_override

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

Source from the content-addressed store, hash-verified

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):
330 flags = 0
331 s = MyPattern('$wHO likes ${WHAT} for ${meal}')
332 d = dict(wHO='tim', WHAT='ham', meal='dinner', w='fred')
333 self.assertRaises(ValueError, s.substitute, d)
334 self.assertEqual(s.safe_substitute(d), 'fredHO likes ${WHAT} for dinner')
335
336 def test_idpattern_override_inside_outside(self):
337 # bpo-1198569: Allow the regexp inside and outside braces to be

Callers

nothing calls this directly

Calls 4

MyPatternClass · 0.85
safe_substituteMethod · 0.80
assertRaisesMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected