mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
str.replace(a, a) is now returning str unchanged if a is a
This commit is contained in:
parent
72ca65dce4
commit
59de0ee9e0
2 changed files with 8 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue