summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_re.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2003-04-25 01:40:11 (GMT)
committerGuido van Rossum <guido@python.org>2003-04-25 01:40:11 (GMT)
commit46144be02cbd6b8d6626c2e5048339364705c454 (patch)
treef539d7e0b974d08e764bfc11c32705e9e966b433 /Lib/test/test_re.py
parentf8d0c075b2290908cf0db7a6d0a68c2d0d690fea (diff)
downloadcpython-46144be02cbd6b8d6626c2e5048339364705c454.zip
cpython-46144be02cbd6b8d6626c2e5048339364705c454.tar.gz
cpython-46144be02cbd6b8d6626c2e5048339364705c454.tar.bz2
Fix test_limitations(). The match there is *expected* to raise
RuntimeError.
Diffstat (limited to 'Lib/test/test_re.py')
-rw-r--r--Lib/test/test_re.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py
index d116c6d..51ab02d 100644
--- a/Lib/test/test_re.py
+++ b/Lib/test/test_re.py
@@ -179,7 +179,12 @@ class ReTests(unittest.TestCase):
def test_limitations(self):
# Try nasty case that overflows the straightforward recursive
# implementation of repeated groups.
- self.assertEqual(re.match('(x)*', 50000*'x').span(), (0, 50000))
+ try:
+ re.match('(x)*', 50000*'x')
+ except RuntimeError, v:
+ self.assertEqual(str(v), "maximum recursion limit exceeded")
+ else:
+ self.fail("re.match('(x)*', 50000*'x') should have failed")
def run_re_tests():
from test.re_tests import benchmarks, tests, SUCCEED, FAIL, SYNTAX_ERROR