mirror of
https://github.com/python/cpython.git
synced 2025-07-31 23:23:11 +00:00
Added tests for implementation error we came up with in the need for speed sprint.
This commit is contained in:
parent
1d2576dbf0
commit
2bddcbf10e
1 changed files with 19 additions and 0 deletions
|
@ -882,6 +882,25 @@ class MixinStrUnicodeUserStringTest:
|
|||
else:
|
||||
self.checkcall(format, "__mod__", value)
|
||||
|
||||
def test_inplace_rewrites(self):
|
||||
# Check that strings don't copy and modify cached single-character strings
|
||||
self.checkequal('a', 'A', 'lower')
|
||||
self.checkequal(True, 'A', 'isupper')
|
||||
self.checkequal('A', 'a', 'upper')
|
||||
self.checkequal(True, 'a', 'islower')
|
||||
|
||||
self.checkequal('a', 'A', 'replace', 'A', 'a')
|
||||
self.checkequal(True, 'A', 'isupper')
|
||||
|
||||
self.checkequal('A', 'a', 'capitalize')
|
||||
self.checkequal(True, 'a', 'islower')
|
||||
|
||||
self.checkequal('A', 'a', 'swapcase')
|
||||
self.checkequal(True, 'a', 'islower')
|
||||
|
||||
self.checkequal('A', 'a', 'title')
|
||||
self.checkequal(True, 'a', 'islower')
|
||||
|
||||
|
||||
class MixinStrStringUserStringTest:
|
||||
# Additional tests for 8bit strings, i.e. str, UserString and
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue