mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
Mark 'abc'.expandtab() optimization as specific to CPython
Improve also str.replace(a, a) test
This commit is contained in:
parent
ba7c226095
commit
1d972ad12a
1 changed files with 4 additions and 3 deletions
|
@ -277,9 +277,9 @@ class UnicodeTest(string_tests.CommonTest,
|
||||||
|
|
||||||
@support.cpython_only
|
@support.cpython_only
|
||||||
def test_replace_id(self):
|
def test_replace_id(self):
|
||||||
a = 'a' # single ascii letters are singletons
|
pattern = 'abc'
|
||||||
text = 'abc'
|
text = 'abc def'
|
||||||
self.assertIs(text.replace('a', 'a'), text)
|
self.assertIs(text.replace(pattern, pattern), text)
|
||||||
|
|
||||||
def test_bytes_comparison(self):
|
def test_bytes_comparison(self):
|
||||||
with support.check_warnings():
|
with support.check_warnings():
|
||||||
|
@ -1579,6 +1579,7 @@ class UnicodeTest(string_tests.CommonTest,
|
||||||
return
|
return
|
||||||
self.assertRaises(OverflowError, 't\tt\t'.expandtabs, sys.maxsize)
|
self.assertRaises(OverflowError, 't\tt\t'.expandtabs, sys.maxsize)
|
||||||
|
|
||||||
|
@support.cpython_only
|
||||||
def test_expandtabs_optimization(self):
|
def test_expandtabs_optimization(self):
|
||||||
s = 'abc'
|
s = 'abc'
|
||||||
self.assertIs(s.expandtabs(), s)
|
self.assertIs(s.expandtabs(), s)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue