diff options
author | Michael W. Hudson <mwh@python.net> | 2002-01-28 15:01:42 (GMT) |
---|---|---|
committer | Michael W. Hudson <mwh@python.net> | 2002-01-28 15:01:42 (GMT) |
commit | 9e4beda3fa5bef6ce6452c0b10f555babc14fa66 (patch) | |
tree | afda7a58e1853f3c5a9dcaefb831bb2a9866039c /Lib | |
parent | d7238ec33fb4d3465eeb56bf6883a28855144f79 (diff) | |
download | cpython-9e4beda3fa5bef6ce6452c0b10f555babc14fa66.zip cpython-9e4beda3fa5bef6ce6452c0b10f555babc14fa66.tar.gz cpython-9e4beda3fa5bef6ce6452c0b10f555babc14fa66.tar.bz2 |
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.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_StringIO.py | 15 |
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 |