summaryrefslogtreecommitdiff
path: root/Lib/test/string_tests.py
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2004-08-26 16:53:04 +0000
committerWalter Dörwald <walter@livinglogic.de>2004-08-26 16:53:04 +0000
commitd87137e9d623d7431989d737f52a999ddc07e63a (patch)
treef81a1db9df1fc66d1a9c19ff9ebab9ddea619e21 /Lib/test/string_tests.py
parent703a7b77192d6d2aa90799fb5d333b1a1b7dd575 (diff)
downloadcpython-d87137e9d623d7431989d737f52a999ddc07e63a.tar.gz
Move test_bug1001011() to string_tests.MixinStrUnicodeTest so that
it can be used for str and unicode. Drop the test for "".join([s]) is s because this is an implementation detail (and doesn't work for unicode)
Diffstat (limited to 'Lib/test/string_tests.py')
-rw-r--r--Lib/test/string_tests.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/Lib/test/string_tests.py b/Lib/test/string_tests.py
index 860c1f2f83..9cf6b9e1cf 100644
--- a/Lib/test/string_tests.py
+++ b/Lib/test/string_tests.py
@@ -648,6 +648,7 @@ class MixinStrUnicodeUserStringTest:
else:
self.checkcall(format, "__mod__", value)
+
class MixinStrStringUserStringTest:
# Additional tests for 8bit strings, i.e. str, UserString and
# the string module
@@ -695,3 +696,21 @@ class MixinStrUserStringTest:
self.checkraises(TypeError, 'xyz', 'decode', 42)
self.checkraises(TypeError, 'xyz', 'encode', 42)
+
+
+class MixinStrUnicodeTest:
+ # Additional tests that only work with
+ # str and unicode
+
+ def test_bug1001011(self):
+ # Make sure join returns a NEW object for single item sequences
+ # involving a subclass
+ # Make sure that it is of the appropriate type
+ # Check the optimisation still occurs for standard objects
+ t = self.type2test
+ class subclass(t):
+ pass
+ s1 = subclass("abcd")
+ s2 = t().join([s1])
+ self.assert_(s1 is not s2)
+ self.assert_(type(s2) is t)