From 73b93cb49ac28f37f5d8143db6c47fef872cb775 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lemburg?= Date: Sun, 6 Jan 2002 17:15:05 +0000 Subject: 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. --- Lib/test/test_StringIO.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'Lib/test') diff --git a/Lib/test/test_StringIO.py b/Lib/test/test_StringIO.py index 8b934fffcd..bf3640cf75 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 -- cgit v1.2.1