Code by Inyeol Lee, submitted to SF bug 595350, to implement

the string/unicode method .replace() with a zero-lengt first argument.
Inyeol contributed tests for this too.
This commit is contained in:
Guido van Rossum 2002-08-23 18:21:28 +00:00
parent 280488b9a3
commit 8b1a6d694f
5 changed files with 59 additions and 46 deletions

View file

@ -202,6 +202,10 @@ def run_method_tests(test):
test('replace', 'one!two!three!', 'one@two@three@', '!', '@')
test('replace', 'one!two!three!', 'one!two!three!', 'x', '@')
test('replace', 'one!two!three!', 'one!two!three!', 'x', '@', 2)
test('replace', 'abc', '-a-b-c-', '', '-')
test('replace', 'abc', '-a-b-c', '', '-', 3)
test('replace', 'abc', 'abc', '', '-', 0)
test('replace', '', '', '', '')
# Next three for SF bug 422088: [OSF1 alpha] string.replace(); died with
# MemoryError due to empty result (platform malloc issue when requesting
# 0 bytes).