summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-07-15 15:49:52 (GMT)
committerGuido van Rossum <guido@python.org>1997-07-15 15:49:52 (GMT)
commit23b8d4c15e4338689c3ac0695fe981eaf62b0c3f (patch)
tree7b97aed6c5c934b61ed899082351ee5399b1d9cc
parent847ed4afb57a4d5449e6a28de13dcb5d8f9840fb (diff)
downloadcpython-23b8d4c15e4338689c3ac0695fe981eaf62b0c3f.zip
cpython-23b8d4c15e4338689c3ac0695fe981eaf62b0c3f.tar.gz
cpython-23b8d4c15e4338689c3ac0695fe981eaf62b0c3f.tar.bz2
Tweak re_tests and test_re to differentiate between
groups that have no value and groups that are out of bounds.
-rw-r--r--Lib/test/output/test_re2
-rwxr-xr-xLib/test/re_tests.py8
-rw-r--r--Lib/test/test_re.py2
3 files changed, 7 insertions, 5 deletions
diff --git a/Lib/test/output/test_re b/Lib/test/output/test_re
index 182ca05..c806244 100644
--- a/Lib/test/output/test_re
+++ b/Lib/test/output/test_re
@@ -59,7 +59,7 @@ test_re
('()ef', 'def', 0, 'found+"-"+g1', 'ef-')
=== Syntax error: ('()ef', 'def', 0, 'found+"-"+g1', 'ef-')
('$b', 'b', 1)
-('a\\(b', 'a(b', 0, 'found+"-"+g1', 'a(b-None')
+('a\\(b', 'a(b', 0, 'found+"-"+g1', 'a(b-Error')
('a\\(*b', 'ab', 0, 'found', 'ab')
('a\\(*b', 'a((b', 0, 'found', 'a((b')
('a\\\\b', 'a\\b', 0, 'found', 'a\\b')
diff --git a/Lib/test/re_tests.py b/Lib/test/re_tests.py
index 393e2b2..5c48fcc 100755
--- a/Lib/test/re_tests.py
+++ b/Lib/test/re_tests.py
@@ -34,8 +34,10 @@ benchmarks = [
# 3: a string that will be eval()'ed to produce a test string.
# This is an arbitrary Python expression; the available
# variables are "found" (the whole match), and "g1", "g2", ...
-# up to "g10" contain the contents of each group, or the
-# string 'None' if the group wasn't given a value.
+# up to "g99" contain the contents of each group, or the
+# string 'None' if the group wasn't given a value, or the
+# string 'Error' if the group index was out of range;
+# also "groups", the return value of m.group() (a tuple).
# 4: The expected result of evaluating the expression.
# If the two don't match, an error is reported.
#
@@ -137,7 +139,7 @@ tests = [
'found+"-"+g1', 'ef-'),
('$b', 'b', FAIL),
('a\\(b', 'a(b', SUCCEED,
- 'found+"-"+g1', 'a(b-None'),
+ 'found+"-"+g1', 'a(b-Error'),
('a\\(*b', 'ab', SUCCEED,
'found', 'ab'),
('a\\(*b', 'a((b', SUCCEED,
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py
index cef14b0..33e9e54 100644
--- a/Lib/test/test_re.py
+++ b/Lib/test/test_re.py
@@ -48,7 +48,7 @@ for t in tests:
# Special hack because else the string concat fails:
if gi is None: gi = "None"
except IndexError:
- gi = "None"
+ gi = "Error"
vardict['g%d' % i] = gi
repl=eval(repl, vardict)
if repl!=expected: