summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_sre.py
diff options
context:
space:
mode:
authorFredrik Lundh <fredrik@pythonware.com>2001-09-18 18:47:09 (GMT)
committerFredrik Lundh <fredrik@pythonware.com>2001-09-18 18:47:09 (GMT)
commit21009b9c6fc40b25fcb30ee60d6108f235733e40 (patch)
tree47c8d39976e3538852a97d33ca57a9a93e6585a8 /Lib/test/test_sre.py
parent18d8d5a708dda187e1ff733f955920d7d5723446 (diff)
downloadcpython-21009b9c6fc40b25fcb30ee60d6108f235733e40.zip
cpython-21009b9c6fc40b25fcb30ee60d6108f235733e40.tar.gz
cpython-21009b9c6fc40b25fcb30ee60d6108f235733e40.tar.bz2
an SRE bugfix a day keeps Guido away...
#462270: sub-tle difference between pre.sub and sre.sub. PRE ignored an empty match at the previous location, SRE didn't. also synced with Secret Labs "sreopen" codebase.
Diffstat (limited to 'Lib/test/test_sre.py')
-rw-r--r--Lib/test/test_sre.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_sre.py b/Lib/test/test_sre.py
index 8442258..49fe4c6 100644
--- a/Lib/test/test_sre.py
+++ b/Lib/test/test_sre.py
@@ -123,6 +123,10 @@ test(r"""sre.sub('\r\n', r'\n', 'abc\r\ndef\r\n')""", 'abc\ndef\n')
test(r"""sre.sub(r'\r\n', '\n', 'abc\r\ndef\r\n')""", 'abc\ndef\n')
test(r"""sre.sub('\r\n', '\n', 'abc\r\ndef\r\n')""", 'abc\ndef\n')
+# Test for empty sub() behaviour, see SF bug #462270
+test(r"""sre.sub('x*', '-', 'abxd')""", '-a-b-d-')
+test(r"""sre.sub('x+', '-', 'abxd')""", 'ab-d')
+
if verbose:
print 'Running tests on symbolic references'