Added tests for qualified sub and split

This commit is contained in:
Guido van Rossum 1998-01-14 16:42:17 +00:00
parent 8687164426
commit f473cb007b
1 changed files with 15 additions and 0 deletions

View File

@ -38,6 +38,12 @@ try:
except AssertionError: except AssertionError:
raise TestFailed, "re.sub" 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: if verbose:
print 'Running tests on symbolic references' print 'Running tests on symbolic references'
@ -115,6 +121,15 @@ try:
except AssertionError: except AssertionError:
raise TestFailed, "re.split" 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: if verbose:
print 'Pickling a RegexObject instance' print 'Pickling a RegexObject instance'
import pickle import pickle