summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_re.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2014-10-01 02:04:28 (GMT)
committerBenjamin Peterson <benjamin@python.org>2014-10-01 02:04:28 (GMT)
commitbc4ece5775acfd56e09ee074a68f1fd379a1d238 (patch)
tree30228d0373f30b4642249773ace9b7eb27bfc946 /Lib/test/test_re.py
parentbc4a834bd5110c4171c03c255c61864a7c3d97fe (diff)
downloadcpython-bc4ece5775acfd56e09ee074a68f1fd379a1d238.zip
cpython-bc4ece5775acfd56e09ee074a68f1fd379a1d238.tar.gz
cpython-bc4ece5775acfd56e09ee074a68f1fd379a1d238.tar.bz2
allow longs as indexes to group() (closes #22530)
Diffstat (limited to 'Lib/test/test_re.py')
-rw-r--r--Lib/test/test_re.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py
index 7bdf353..3c779486 100644
--- a/Lib/test/test_re.py
+++ b/Lib/test/test_re.py
@@ -971,6 +971,10 @@ subpattern None
pat.split(string='abracadabra', maxsplit=1),
['', 'ab', 'racadabra'])
+ def test_match_group_takes_long(self):
+ self.assertEqual(re.match("(foo)", "foo").group(1L), "foo")
+ self.assertRaises(IndexError, re.match("", "").group, sys.maxint + 1)
+
def run_re_tests():
from test.re_tests import tests, SUCCEED, FAIL, SYNTAX_ERROR