summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_StringIO.py
diff options
context:
space:
mode:
authorMarc-André Lemburg <mal@egenix.com>2002-01-06 17:15:05 (GMT)
committerMarc-André Lemburg <mal@egenix.com>2002-01-06 17:15:05 (GMT)
commitf853be980ee54e8f61fa8d70a7b4724e26ac2035 (patch)
treedd0f3960724eb8991eff5fd5c9afb1a1ae6d93c2 /Lib/test/test_StringIO.py
parent23105d5c24579ae0278ed4dcd3905565e15f34a3 (diff)
downloadcpython-f853be980ee54e8f61fa8d70a7b4724e26ac2035.zip
cpython-f853be980ee54e8f61fa8d70a7b4724e26ac2035.tar.gz
cpython-f853be980ee54e8f61fa8d70a7b4724e26ac2035.tar.bz2
Restore Python 2.1 StringIO.py behaviour: support concatenating
Unicode string snippets to larger Unicode strings. This fix should also go into Python 2.2.1.
Diffstat (limited to 'Lib/test/test_StringIO.py')
-rw-r--r--Lib/test/test_StringIO.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_StringIO.py b/Lib/test/test_StringIO.py
index 8b934ff..bf3640c 100644
--- a/Lib/test/test_StringIO.py
+++ b/Lib/test/test_StringIO.py
@@ -71,6 +71,21 @@ class TestGenericStringIO(unittest.TestCase):
class TestStringIO(TestGenericStringIO):
MODULE = StringIO
+ def test_unicode(self):
+
+ # The StringIO module also supports concatenating Unicode
+ # snippets to larger Unicode strings. This is tested by this
+ # method. Note that cStringIO does not support this extension.
+
+ f = self.MODULE.StringIO()
+ f.write(self._line[:6])
+ f.seek(3)
+ f.write(unicode(self._line[20:26]))
+ f.write(unicode(self._line[52]))
+ s = f.getvalue()
+ self.assertEqual(s, unicode('abcuvwxyz!'))
+ self.assertEqual(type(s), types.UnicodeType)
+
class TestcStringIO(TestGenericStringIO):
MODULE = cStringIO