diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-08-19 20:18:23 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-08-19 20:18:23 (GMT) |
commit | 98985a1980304b3c8fee9b9efdac015c6098bd67 (patch) | |
tree | 7f3966873256138526d5dffcddcf26fe2d844139 /Lib/test | |
parent | 1ca66edbc50aa1b1e5d010f722e708756cce3214 (diff) | |
download | cpython-98985a1980304b3c8fee9b9efdac015c6098bd67.zip cpython-98985a1980304b3c8fee9b9efdac015c6098bd67.tar.gz cpython-98985a1980304b3c8fee9b9efdac015c6098bd67.tar.bz2 |
Issue #2537: Remove breaked check which prevented valid regular expressions.
Patch by Meador Inge.
See also issue #18647.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_re.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py index c84d4ed..2104437 100644 --- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -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: |