diff options
author | Marc-André Lemburg <mal@egenix.com> | 2002-01-06 17:15:05 +0000 |
---|---|---|
committer | Marc-André Lemburg <mal@egenix.com> | 2002-01-06 17:15:05 +0000 |
commit | 73b93cb49ac28f37f5d8143db6c47fef872cb775 (patch) | |
tree | b02593f6687b52b15c65673860f699befe6e020b /Lib/test | |
parent | c66569f2ce998b774710ba99bec4a308eb21bcb8 (diff) | |
download | cpython-73b93cb49ac28f37f5d8143db6c47fef872cb775.tar.gz |
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')
-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 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 |