summaryrefslogtreecommitdiff
path: root/Lib/test/test_re.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-08-19 23:19:49 +0300
committerSerhiy Storchaka <storchaka@gmail.com>2013-08-19 23:19:49 +0300
commit228c194596b8e357ae586a76ee392740107bd663 (patch)
tree5254ce79c68d6edbc4da2dc2a071064737d14a9d /Lib/test/test_re.py
parent75674ae8ddc9ab83200919de6f75ead695be9bcb (diff)
parent98985a1980304b3c8fee9b9efdac015c6098bd67 (diff)
downloadcpython-git-228c194596b8e357ae586a76ee392740107bd663.tar.gz
Issue #2537: Remove breaked check which prevented valid regular expressions.
Patch by Meador Inge. See also issue #18647.
Diffstat (limited to 'Lib/test/test_re.py')
-rw-r--r--Lib/test/test_re.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py
index c84d4edeb4..2104437408 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: