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

Class BadPattern

Lib/test/test_string/test_string.py:376–383  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

374 self.assertEqual(s.substitute(m), 'tim likes to eat a bag of ham')
375
376 class BadPattern(Template):
377 pattern = r"""
378 (?P<badname>.*) |
379 (?P<escaped>@{2}) |
380 @(?P<named>[_a-z][._a-z0-9]*) |
381 @{(?P<braced>[_a-z][._a-z0-9]*)} |
382 (?P<invalid>@) |
383 """
384 s = BadPattern('@bag.foo.who likes to eat a bag of @bag.what')
385 self.assertRaises(ValueError, s.substitute, {})
386 self.assertRaises(ValueError, s.safe_substitute, {})

Callers 3

test_pattern_overrideMethod · 0.85
test_is_validMethod · 0.85
test_get_identifiersMethod · 0.85

Calls

no outgoing calls

Tested by 3

test_pattern_overrideMethod · 0.68
test_is_validMethod · 0.68
test_get_identifiersMethod · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…