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

Method checkTemplateError

Lib/test/test_re.py:57–64  ·  view source on GitHub ↗
(self, pattern, repl, string, errmsg, pos=None)

Source from the content-addressed store, hash-verified

55 self.assertEqual(err.pos, pos)
56
57 def checkTemplateError(self, pattern, repl, string, errmsg, pos=None):
58 with self.assertRaises(re.PatternError) as cm:
59 re.sub(pattern, repl, string)
60 with self.subTest(pattern=pattern, repl=repl):
61 err = cm.exception
62 self.assertEqual(err.msg, errmsg)
63 if pos is not None:
64 self.assertEqual(err.pos, pos)
65
66 def test_error_is_PatternError_alias(self):
67 assert re.error is re.PatternError

Calls 4

assertRaisesMethod · 0.45
subMethod · 0.45
subTestMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected