Mercurial > cpython-lru_cache-weakref
diff Lib/test/test_StringIO.py @ 33213:db1bafa9b656 legacy-trunk
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.
| author | Tim Peters <tim.peters@gmail.com> |
|---|---|
| date | Sat, 21 Aug 2004 06:55:43 +0000 |
| parents | 06016d5d81d7 |
| children | a8c979cc4fa6 |
line wrap: on
line diff
--- a/Lib/test/test_StringIO.py Fri Aug 20 23:13:26 2004 +0000 +++ b/Lib/test/test_StringIO.py Sat Aug 21 06:55:43 2004 +0000 @@ -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')
