#13899: \A, \Z, and \B now correctly match the A, Z, and B literals when used inside character classes (e.g. [A]). Patch by Matthew Barnett.

This commit is contained in:
Ezio Melotti 2013-01-11 08:32:01 +02:00
parent 26ed234052
commit fe8e6e7414
4 changed files with 11 additions and 1 deletions

View file

@ -857,6 +857,12 @@ class ReTests(unittest.TestCase):
# Test behaviour when not given a string or pattern as parameter
self.assertRaises(TypeError, re.compile, 0)
def test_bug_13899(self):
# Issue #13899: re pattern r"[\A]" should work like "A" but matches
# nothing. Ditto B and Z.
self.assertEqual(re.findall(r'[\A\B\b\C\Z]', 'AB\bCZ'),
['A', 'B', '\b', 'C', 'Z'])
@bigmemtest(size=_2G, memuse=character_size)
def test_large_search(self, size):
# Issue #10182: indices were 32-bit-truncated.