diff options
author | Andrew Dalke <dalke@dalkescientific.com> | 2006-05-25 16:30:52 (GMT) |
---|---|---|
committer | Andrew Dalke <dalke@dalkescientific.com> | 2006-05-25 16:30:52 (GMT) |
commit | 2bddcbf10ed5fa0142a95f4e5d66acda355bf9e4 (patch) | |
tree | 78243d57e662bd0707b720eb67db2c0a23edf6e6 /Lib | |
parent | 1d2576dbf07e50242cb8eb2362e2289691e80915 (diff) | |
download | cpython-2bddcbf10ed5fa0142a95f4e5d66acda355bf9e4.zip cpython-2bddcbf10ed5fa0142a95f4e5d66acda355bf9e4.tar.gz cpython-2bddcbf10ed5fa0142a95f4e5d66acda355bf9e4.tar.bz2 |
Added tests for implementation error we came up with in the need for speed sprint.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/string_tests.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Lib/test/string_tests.py b/Lib/test/string_tests.py index 3a5fbfe..f76a9eb 100644 --- a/Lib/test/string_tests.py +++ b/Lib/test/string_tests.py @@ -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 |