summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-01-14 16:42:17 (GMT)
committerGuido van Rossum <guido@python.org>1998-01-14 16:42:17 (GMT)
commitf473cb007b774cabcb712e8c4f36fbf2dae1b85d (patch)
treead51dcc4b6cc41ff9626bca1c4beb03e0f610140 /Lib
parent8687164426da64ec03762c0e73daac91fba17927 (diff)
downloadcpython-f473cb007b774cabcb712e8c4f36fbf2dae1b85d.zip
cpython-f473cb007b774cabcb712e8c4f36fbf2dae1b85d.tar.gz
cpython-f473cb007b774cabcb712e8c4f36fbf2dae1b85d.tar.bz2
Added tests for qualified sub and split
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_re.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py
index 99263b8..b47c105 100644
--- a/Lib/test/test_re.py
+++ b/Lib/test/test_re.py
@@ -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