Commit 90a07913 authored by Fredrik Lundh's avatar Fredrik Lundh

- pedantic: make sure "python -t" doesn't complain...

parent df02d0b3
......@@ -98,7 +98,7 @@ def _subn(pattern, template, string, count=0):
if callable(template):
filter = template
else:
template = sre_parse.parse_template(template, pattern)
template = sre_parse.parse_template(template, pattern)
def filter(match, template=template):
return sre_parse.expand_template(template, match)
n = i = 0
......@@ -109,11 +109,11 @@ def _subn(pattern, template, string, count=0):
m = c.search()
if not m:
break
b, e = m.span()
b, e = m.span()
if i < b:
append(string[i:b])
append(filter(m))
i = e
i = e
n = n + 1
append(string[i:])
return string[:0].join(s), n
......@@ -130,15 +130,15 @@ def _split(pattern, string, maxsplit=0):
m = c.search()
if not m:
break
b, e = m.span()
if b == e:
if i >= len(string):
break
continue
b, e = m.span()
if b == e:
if i >= len(string):
break
continue
append(string[i:b])
if g and b != e:
extend(m.groups())
i = e
if g and b != e:
extend(m.groups())
i = e
n = n + 1
append(string[i:])
return s
This diff is collapsed.
This diff is collapsed.
# FIXME: this is basically test_re.py, with a few
# FIXME: this is basically test_re.py, with a few minor changes
import sys
sys.path=['.']+sys.path
......@@ -337,7 +337,7 @@ for t in tests:
print repr(repl)+' should be '+repr(expected)
else:
print '=== Failed incorrectly', t
continue
continue
# Try the match on a unicode string, and check that it
# still succeeds.
......@@ -359,9 +359,9 @@ for t in tests:
if pattern[:2]!='\\B' and pattern[-2:]!='\\B':
obj=sre.compile(pattern)
result=obj.search(s, result.start(0), result.end(0)+1)
if result==None:
print '=== Failed on range-limited match', t
result=obj.search(s, result.start(0), result.end(0)+1)
if result==None:
print '=== Failed on range-limited match', t
# Try the match with IGNORECASE enabled, and check that it
# still succeeds.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment