mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #2537: Remove breaked check which prevented valid regular expressions.
Patch by Meador Inge. See also issue #18647.
This commit is contained in:
parent
1ca66edbc5
commit
98985a1980
2 changed files with 10 additions and 2 deletions
|
@ -1051,6 +1051,16 @@ class ReTests(unittest.TestCase):
|
|||
[b'xyz'], msg=pattern)
|
||||
|
||||
|
||||
def test_bug_2537(self):
|
||||
# issue 2537: empty submatches
|
||||
for outer_op in ('{0,}', '*', '+', '{1,187}'):
|
||||
for inner_op in ('{0,}', '*', '?'):
|
||||
r = re.compile("^((x|y)%s)%s" % (inner_op, outer_op))
|
||||
m = r.match("xyyzy")
|
||||
self.assertEqual(m.group(0), "xyy")
|
||||
self.assertEqual(m.group(1), "")
|
||||
self.assertEqual(m.group(2), "y")
|
||||
|
||||
def run_re_tests():
|
||||
from test.re_tests import tests, SUCCEED, FAIL, SYNTAX_ERROR
|
||||
if verbose:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue