summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_unicode.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@wyplay.com>2011-10-07 08:01:28 (GMT)
committerVictor Stinner <vstinner@wyplay.com>2011-10-07 08:01:28 (GMT)
commit59de0ee9e087a819a0a63b31c1391c6eee55b8ef (patch)
treea460b0d2c099e04b6dbc661c90227fe3daa30d3d /Lib/test/test_unicode.py
parent72ca65dce4529906b64710e94a3c004f9cc2712f (diff)
downloadcpython-59de0ee9e087a819a0a63b31c1391c6eee55b8ef.zip
cpython-59de0ee9e087a819a0a63b31c1391c6eee55b8ef.tar.gz
cpython-59de0ee9e087a819a0a63b31c1391c6eee55b8ef.tar.bz2
str.replace(a, a) is now returning str unchanged if a is a
Diffstat (limited to 'Lib/test/test_unicode.py')
-rw-r--r--Lib/test/test_unicode.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py
index 870853e..14d3fa6 100644
--- a/Lib/test/test_unicode.py
+++ b/Lib/test/test_unicode.py
@@ -275,6 +275,12 @@ class UnicodeTest(string_tests.CommonTest,
self.checkequalnofix('one@two!three!', 'one!two!three!', 'replace', '!', '@', 1)
self.assertRaises(TypeError, 'replace'.replace, "r", 42)
+ @support.cpython_only
+ def test_replace_id(self):
+ a = 'a' # single ascii letters are singletons
+ text = 'abc'
+ self.assertIs(text.replace('a', 'a'), text)
+
def test_bytes_comparison(self):
with support.check_warnings():
warnings.simplefilter('ignore', BytesWarning)