[Python-checkins] cpython: Mark 'abc'.expandtab() optimization as specific to CPython
victor.stinner
python-checkins at python.org
Fri Oct 7 13:32:43 CEST 2011
http://hg.python.org/cpython/rev/e3d5b718f2e6
changeset: 72788:e3d5b718f2e6
user: Victor Stinner <vstinner at wyplay.com>
date: Fri Oct 07 13:31:46 2011 +0200
summary:
Mark 'abc'.expandtab() optimization as specific to CPython
Improve also str.replace(a, a) test
files:
Lib/test/test_unicode.py | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py
--- a/Lib/test/test_unicode.py
+++ b/Lib/test/test_unicode.py
@@ -277,9 +277,9 @@
@support.cpython_only
def test_replace_id(self):
- a = 'a' # single ascii letters are singletons
- text = 'abc'
- self.assertIs(text.replace('a', 'a'), text)
+ pattern = 'abc'
+ text = 'abc def'
+ self.assertIs(text.replace(pattern, pattern), text)
def test_bytes_comparison(self):
with support.check_warnings():
@@ -1579,6 +1579,7 @@
return
self.assertRaises(OverflowError, 't\tt\t'.expandtabs, sys.maxsize)
+ @support.cpython_only
def test_expandtabs_optimization(self):
s = 'abc'
self.assertIs(s.expandtabs(), s)
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list