]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Mark 'abc'.expandtab() optimization as specific to CPython
authorVictor Stinner <vstinner@wyplay.com>
Fri, 7 Oct 2011 11:31:46 +0000 (13:31 +0200)
committerVictor Stinner <vstinner@wyplay.com>
Fri, 7 Oct 2011 11:31:46 +0000 (13:31 +0200)
Improve also str.replace(a, a) test

Lib/test/test_unicode.py

index 14d3fa6269a5d9b2141e96cb662a0cccb4d1ad4c..27df862800bbda072497a50e901ad3abe6642c94 100644 (file)
@@ -277,9 +277,9 @@ class UnicodeTest(string_tests.CommonTest,
 
     @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 @@ class UnicodeTest(string_tests.CommonTest,
             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)