diff options
author | Guido van Rossum <guido@python.org> | 2007-03-07 05:23:25 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-03-07 05:23:25 (GMT) |
commit | 00efeadbcf2bfdeb805eecbb6d486b0bf93c3738 (patch) | |
tree | 6edb8f8c0cdd997f6b59e801b08cf6e91071370d /Lib/test | |
parent | 01a2752d19d0ad615c989b8d742a736ca8d51a57 (diff) | |
download | cpython-00efeadbcf2bfdeb805eecbb6d486b0bf93c3738.zip cpython-00efeadbcf2bfdeb805eecbb6d486b0bf93c3738.tar.gz cpython-00efeadbcf2bfdeb805eecbb6d486b0bf93c3738.tar.bz2 |
Change the specs for readinto() -- it should *not* shorten the buffer to
the amount of data read.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_io.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py index 1be1b71..03cdfef 100644 --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -70,10 +70,13 @@ class IOTest(unittest.TestCase): def read_ops(self, f): data = f.read(5) self.assertEqual(data, b"hello") - f.readinto(data) + n = f.readinto(data) + self.assertEqual(n, 5) self.assertEqual(data, b" worl") - f.readinto(data) - self.assertEqual(data, b"d\n") + n = f.readinto(data) + self.assertEqual(n, 2) + self.assertEqual(len(data), 5) + self.assertEqual(data[:2], b"d\n") f.seek(0) self.assertEqual(f.read(20), b"hello world\n") f.seek(-6, 2) |