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

Method checkPatternError

Lib/test/test_re.py:48–55  ·  view source on GitHub ↗
(self, pattern, errmsg, pos=None)

Source from the content-addressed store, hash-verified

46 recurse(actual, expect)
47
48 def checkPatternError(self, pattern, errmsg, pos=None):
49 with self.assertRaises(re.PatternError) as cm:
50 re.compile(pattern)
51 with self.subTest(pattern=pattern):
52 err = cm.exception
53 self.assertEqual(err.msg, errmsg)
54 if pos is not None:
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:

Calls 4

assertRaisesMethod · 0.45
compileMethod · 0.45
subTestMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected