Make cStringIO.truncate raise IOError for negative

arguments (even for -1). Fixes the last bit of
#1359365.
This commit is contained in:
Martin v. Löwis 2006-11-19 10:41:41 +00:00
parent 283a1353a0
commit cffcc8b195
3 changed files with 15 additions and 1 deletions

View file

@ -62,6 +62,7 @@ class TestGenericStringIO(unittest.TestCase):
eq(f.getvalue(), 'abcde')
f.write('xyz')
eq(f.getvalue(), 'abcdexyz')
self.assertRaises(IOError, f.truncate, -1)
f.close()
self.assertRaises(ValueError, f.write, 'frobnitz')