diff options
author | Guido van Rossum <guido@python.org> | 2002-08-09 15:36:48 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2002-08-09 15:36:48 (GMT) |
commit | f36921c4b0ca499134b44ff3594c6c43768799c2 (patch) | |
tree | 18a7adf8b50de381b1d498382ea3163068845eb6 /Lib | |
parent | 3bc3f28dbec7ec3f221d9293e05e0cf1ba5f20aa (diff) | |
download | cpython-f36921c4b0ca499134b44ff3594c6c43768799c2.zip cpython-f36921c4b0ca499134b44ff3594c6c43768799c2.tar.gz cpython-f36921c4b0ca499134b44ff3594c6c43768799c2.tar.bz2 |
Unicode replace() method with empty pattern argument should fail, like
it does for 8-bit strings.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_unicode.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py index 429b673..a915b2e 100644 --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -206,6 +206,12 @@ 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('startswith', u'hello', True, u'he') test('startswith', u'hello', True, u'hello') |