Kaydet (Commit) f473cb00 authored tarafından Guido van Rossum's avatar Guido van Rossum

Added tests for qualified sub and split

üst 86871644
......@@ -38,6 +38,12 @@ try:
except AssertionError:
raise TestFailed, "re.sub"
try:
assert re.sub('a', 'b', 'aaaaa') == 'bbbbb'
assert re.sub('a', 'b', 'aaaaa', 1) == 'baaaa'
except AssertionError:
raise TestFailed, "qualified re.sub"
if verbose:
print 'Running tests on symbolic references'
......@@ -115,6 +121,15 @@ try:
except AssertionError:
raise TestFailed, "re.split"
try:
assert re.split(":", ":a:b::c", 2) == ['', 'a', 'b::c']
assert re.split(':', 'a:b:c:d', 2) == ['a', 'b', 'c:d']
assert re.split("(:)", ":a:b::c", 2) == ['', ':', 'a', ':', 'b::c']
assert re.split("(:*)", ":a:b::c", 2) == ['', ':', 'a', ':', 'b::c']
except AssertionError:
raise TestFailed, "qualified re.split"
if verbose:
print 'Pickling a RegexObject instance'
import pickle
......
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