diff options
author | Alexandre Vassalotti <alexandre@peadrop.com> | 2008-05-06 19:48:38 (GMT) |
---|---|---|
committer | Alexandre Vassalotti <alexandre@peadrop.com> | 2008-05-06 19:48:38 (GMT) |
commit | 77250f4df7a73a5c87d12d781a562747a855cd95 (patch) | |
tree | 61f83259cd270f6011c75cbe95d2a25d12c29f87 /Lib/test/test_io.py | |
parent | 5d8da20dd1034081906dbdffea9c77bf39353dec (diff) | |
download | cpython-77250f4df7a73a5c87d12d781a562747a855cd95.zip cpython-77250f4df7a73a5c87d12d781a562747a855cd95.tar.gz cpython-77250f4df7a73a5c87d12d781a562747a855cd95.tar.bz2 |
Added fast alternate io.BytesIO implementation and its test suite.
Removed old test suite for StringIO.
Modified truncate() to imply a seek to given argument value.
Diffstat (limited to 'Lib/test/test_io.py')
-rw-r--r-- | Lib/test/test_io.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py index ba3ceeb..fa3a8bb 100644 --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -98,7 +98,7 @@ class IOTest(unittest.TestCase): self.assertEqual(f.seek(-1, 2), 13) self.assertEqual(f.tell(), 13) self.assertEqual(f.truncate(12), 12) - self.assertEqual(f.tell(), 13) + self.assertEqual(f.tell(), 12) self.assertRaises(TypeError, f.seek, 0.0) def read_ops(self, f, buffered=False): @@ -143,7 +143,7 @@ class IOTest(unittest.TestCase): self.assertEqual(f.tell(), self.LARGE + 2) self.assertEqual(f.seek(0, 2), self.LARGE + 2) self.assertEqual(f.truncate(self.LARGE + 1), self.LARGE + 1) - self.assertEqual(f.tell(), self.LARGE + 2) + self.assertEqual(f.tell(), self.LARGE + 1) self.assertEqual(f.seek(0, 2), self.LARGE + 1) self.assertEqual(f.seek(-1, 2), self.LARGE) self.assertEqual(f.read(2), b"x") @@ -727,6 +727,7 @@ class TextIOWrapperTest(unittest.TestCase): txt.write("BB\nCCC\n") txt.write("X\rY\r\nZ") txt.flush() + self.assertEquals(buf.closed, False) self.assertEquals(buf.getvalue(), expected) def testNewlines(self): @@ -807,7 +808,8 @@ class TextIOWrapperTest(unittest.TestCase): txt = io.TextIOWrapper(buf, encoding="ascii", newline=newline) txt.write(data) txt.close() - self.assertEquals(buf.getvalue(), expected) + self.assertEquals(buf.closed, True) + self.assertRaises(ValueError, buf.getvalue) finally: os.linesep = save_linesep |