Mercurial > cpython-lru_cache-weakref
diff Lib/test/test_StringIO.py @ 21821:1d86cdb17291 2.2
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.
| author | Michael W. Hudson <mwh@python.net> |
|---|---|
| date | Mon, 28 Jan 2002 15:01:42 +0000 |
| parents | 60df2bf854ac |
| children | 165e20ac0ab1 5ed782bdbb2a |
line wrap: on
line diff
--- a/Lib/test/test_StringIO.py Mon Jan 28 15:00:27 2002 +0000 +++ b/Lib/test/test_StringIO.py Mon Jan 28 15:01:42 2002 +0000 @@ -71,6 +71,21 @@ 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
