summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2004-08-21 06:55:43 (GMT)
committerTim Peters <tim.peters@gmail.com>2004-08-21 06:55:43 (GMT)
commit037b3ee44e7de00b4653d73d4808c0f679a909a7 (patch)
tree88ecf25c35a355258bb869acab244cc1b48b4466 /Lib
parent7109b287cf84cebdfa99b2b0a657d55f6e481be7 (diff)
downloadcpython-037b3ee44e7de00b4653d73d4808c0f679a909a7.zip
cpython-037b3ee44e7de00b4653d73d4808c0f679a909a7.tar.gz
cpython-037b3ee44e7de00b4653d73d4808c0f679a909a7.tar.bz2
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.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_StringIO.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/test/test_StringIO.py b/Lib/test/test_StringIO.py
index c318eaa..6842c5e 100644
--- a/Lib/test/test_StringIO.py
+++ b/Lib/test/test_StringIO.py
@@ -49,9 +49,10 @@ class TestGenericStringIO(unittest.TestCase):
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')