[Python-checkins] python/dist/src/Lib/test test_StringIO.py, 1.17, 1.18

tim_one at users.sourceforge.net tim_one at users.sourceforge.net
Sat Aug 21 08:55:44 CEST 2004


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13308/Lib/test

Modified Files:
	test_StringIO.py 
Log Message:
Patch 1012740:  cStringIO's truncate doesn't

truncate() left the stream position unchanged, which meant the
"truncated" data didn't go away:

>>> io.write('abc')
>>> io.truncate(0)
>>> io.write('xyz')
>>> io.getvalue()
'abcxyz'

Patch by Dima Dorfman.


Index: test_StringIO.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_StringIO.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- test_StringIO.py	8 Aug 2003 12:20:03 -0000	1.17
+++ test_StringIO.py	21 Aug 2004 06:55:42 -0000	1.18
@@ -49,9 +49,10 @@
         f.seek(10)
         f.truncate()
         eq(f.getvalue(), 'abcdefghij')
-        f.seek(0)
         f.truncate(5)
         eq(f.getvalue(), 'abcde')
+        f.write('xyz')
+        eq(f.getvalue(), 'abcdexyz')
         f.close()
         self.assertRaises(ValueError, f.write, 'frobnitz')
 



More information about the Python-checkins mailing list