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

Method test_character_set_errors

Lib/test/test_re.py:1558–1567  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1556 self.checkPatternError(br"[\x1z]", r'incomplete escape \x1', 1)
1557
1558 def test_character_set_errors(self):
1559 self.checkPatternError(r'[', 'unterminated character set', 0)
1560 self.checkPatternError(r'[^', 'unterminated character set', 0)
1561 self.checkPatternError(r'[a', 'unterminated character set', 0)
1562 # bug 545855 -- This pattern failed to cause a compile error as it
1563 # should, instead provoking a TypeError.
1564 self.checkPatternError(r"[a-", 'unterminated character set', 0)
1565 self.checkPatternError(r"[\w-b]", r'bad character range \w-b', 1)
1566 self.checkPatternError(r"[a-\w]", r'bad character range a-\w', 1)
1567 self.checkPatternError(r"[b-a]", 'bad character range b-a', 1)
1568
1569 def test_bug_113254(self):
1570 self.assertEqual(re.match(r'(a)|(b)', 'b').start(1), -1)

Callers

nothing calls this directly

Calls 1

checkPatternErrorMethod · 0.95

Tested by

no test coverage detected