From 9e4beda3fa5bef6ce6452c0b10f555babc14fa66 Mon Sep 17 00:00:00 2001 From: "Michael W. Hudson" Date: Mon, 28 Jan 2002 15:01:42 +0000 Subject: [PATCH] It's merge time! Backport lemburg's checkin of revision 1.11: 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(+) diff --git a/Lib/test/test_StringIO.py b/Lib/test/test_StringIO.py index 8b934fffcdfe..bf3640cf75e5 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 -- 2.47.3