summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_unicode.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2002-08-23 18:21:28 (GMT)
committerGuido van Rossum <guido@python.org>2002-08-23 18:21:28 (GMT)
commit8b1a6d694fa2f38cde77892c5ee0bb177be49db6 (patch)
treee3f7c901c642cd2500cb87648b6976c8d539a1fb /Lib/test/test_unicode.py
parent280488b9a3b5cc213d01aae794751b89144f8609 (diff)
downloadcpython-8b1a6d694fa2f38cde77892c5ee0bb177be49db6.zip
cpython-8b1a6d694fa2f38cde77892c5ee0bb177be49db6.tar.gz
cpython-8b1a6d694fa2f38cde77892c5ee0bb177be49db6.tar.bz2
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.
Diffstat (limited to 'Lib/test/test_unicode.py')
-rw-r--r--Lib/test/test_unicode.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py
index 4efa39c..90147eb 100644
--- a/Lib/test/test_unicode.py
+++ b/Lib/test/test_unicode.py
@@ -210,12 +210,10 @@ test('replace', u'one!two!three!', u'one!two!three!', u'!', u'@', 0)
test('replace', u'one!two!three!', u'one@two@three@', u'!', u'@')
test('replace', u'one!two!three!', u'one!two!three!', u'x', u'@')
test('replace', u'one!two!three!', u'one!two!three!', u'x', u'@', 2)
-try:
- u"abc".replace(u"", u"x")
-except ValueError:
- pass
-else:
- raise TestFailed, "u.replace('', ...) should raise ValueError"
+test('replace', u'abc', u'-a-b-c-', u'', u'-')
+test('replace', u'abc', u'-a-b-c', u'', u'-', 3)
+test('replace', u'abc', u'abc', u'', u'-', 0)
+test('replace', u'', u'', u'', u'')
test('startswith', u'hello', True, u'he')
test('startswith', u'hello', True, u'hello')