summaryrefslogtreecommitdiffstats
path: root/Lib/dos-8x3/test_reg.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-03-26 22:14:20 (GMT)
committerGuido van Rossum <guido@python.org>1998-03-26 22:14:20 (GMT)
commit548703a1b81f6adf68a3dd4b497a88f5c4a31f4a (patch)
tree8fc46e5faa2a7e82e6748995c555d7fe0b781449 /Lib/dos-8x3/test_reg.py
parent65e5399081e23d7b1efbf685096c65d0a0ab912b (diff)
downloadcpython-548703a1b81f6adf68a3dd4b497a88f5c4a31f4a.zip
cpython-548703a1b81f6adf68a3dd4b497a88f5c4a31f4a.tar.gz
cpython-548703a1b81f6adf68a3dd4b497a88f5c4a31f4a.tar.bz2
The usual.
Diffstat (limited to 'Lib/dos-8x3/test_reg.py')
-rw-r--r--Lib/dos-8x3/test_reg.py70
1 files changed, 35 insertions, 35 deletions
diff --git a/Lib/dos-8x3/test_reg.py b/Lib/dos-8x3/test_reg.py
index 4be6026..6a7f01b 100644
--- a/Lib/dos-8x3/test_reg.py
+++ b/Lib/dos-8x3/test_reg.py
@@ -67,44 +67,44 @@ if verbose: print 'Running regex_tests test suite'
for t in tests:
pattern=s=outcome=repl=expected=None
if len(t)==5:
- pattern, s, outcome, repl, expected = t
+ pattern, s, outcome, repl, expected = t
elif len(t)==3:
- pattern, s, outcome = t
+ pattern, s, outcome = t
else:
- raise ValueError, ('Test tuples should have 3 or 5 fields',t)
+ raise ValueError, ('Test tuples should have 3 or 5 fields',t)
try:
- obj=regex.compile(pattern)
+ obj=regex.compile(pattern)
except regex.error:
- if outcome==SYNTAX_ERROR: pass # Expected a syntax error
- else:
- # Regex syntax errors aren't yet reported, so for
- # the official test suite they'll be quietly ignored.
- pass
- #print '=== Syntax error:', t
+ if outcome==SYNTAX_ERROR: pass # Expected a syntax error
+ else:
+ # Regex syntax errors aren't yet reported, so for
+ # the official test suite they'll be quietly ignored.
+ pass
+ #print '=== Syntax error:', t
else:
- try:
- result=obj.search(s)
- except regex.error, msg:
- print '=== Unexpected exception', t, repr(msg)
- if outcome==SYNTAX_ERROR:
- # This should have been a syntax error; forget it.
- pass
- elif outcome==FAIL:
- if result==-1: pass # No match, as expected
- else: print '=== Succeeded incorrectly', t
- elif outcome==SUCCEED:
- if result!=-1:
- # Matched, as expected, so now we compute the
- # result string and compare it to our expected result.
- start, end = obj.regs[0]
- found=s[start:end]
- groups=obj.group(1,2,3,4,5,6,7,8,9,10)
- vardict=vars()
- for i in range(len(groups)):
- vardict['g'+str(i+1)]=str(groups[i])
- repl=eval(repl)
- if repl!=expected:
- print '=== grouping error', t, repr(repl)+' should be '+repr(expected)
- else:
- print '=== Failed incorrectly', t
+ try:
+ result=obj.search(s)
+ except regex.error, msg:
+ print '=== Unexpected exception', t, repr(msg)
+ if outcome==SYNTAX_ERROR:
+ # This should have been a syntax error; forget it.
+ pass
+ elif outcome==FAIL:
+ if result==-1: pass # No match, as expected
+ else: print '=== Succeeded incorrectly', t
+ elif outcome==SUCCEED:
+ if result!=-1:
+ # Matched, as expected, so now we compute the
+ # result string and compare it to our expected result.
+ start, end = obj.regs[0]
+ found=s[start:end]
+ groups=obj.group(1,2,3,4,5,6,7,8,9,10)
+ vardict=vars()
+ for i in range(len(groups)):
+ vardict['g'+str(i+1)]=str(groups[i])
+ repl=eval(repl)
+ if repl!=expected:
+ print '=== grouping error', t, repr(repl)+' should be '+repr(expected)
+ else:
+ print '=== Failed incorrectly', t