[Python-checkins] CVS: python/dist/src/Lib/test test_StringIO.py,1.10,1.11

M.-A. Lemburg lemburg@users.sourceforge.net
Sun, 06 Jan 2002 09:15:07 -0800


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv4886/Lib/test

Modified Files:
	test_StringIO.py 
Log Message:
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.



Index: test_StringIO.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_StringIO.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** test_StringIO.py	2001/12/09 20:06:32	1.10
--- test_StringIO.py	2002/01/06 17:15:05	1.11
***************
*** 72,75 ****
--- 72,90 ----
      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