diff options
author | Guido van Rossum <guido@python.org> | 2007-06-07 23:45:37 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-06-07 23:45:37 (GMT) |
commit | 48fc58ad31408e0f452d046a23c59b7556f6a9b0 (patch) | |
tree | ef1405180331f17842dd8880057768b7410d99e2 /Lib/test/test_io.py | |
parent | 1325790b932c4bab4f8f94f5a36c09f4036ed9f8 (diff) | |
download | cpython-48fc58ad31408e0f452d046a23c59b7556f6a9b0.zip cpython-48fc58ad31408e0f452d046a23c59b7556f6a9b0.tar.gz cpython-48fc58ad31408e0f452d046a23c59b7556f6a9b0.tar.bz2 |
Accellerate binary readline() a bit.
Diffstat (limited to 'Lib/test/test_io.py')
-rw-r--r-- | Lib/test/test_io.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py index c98d61f..c555623 100644 --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -168,6 +168,18 @@ class IOTest(unittest.TestCase): self.read_ops(f, True) f.close() + def test_readline(self): + f = io.open(test_support.TESTFN, "wb") + f.write(b"abc\ndef\nxyzzy\nfoo") + f.close() + f = io.open(test_support.TESTFN, "rb") + self.assertEqual(f.readline(), b"abc\n") + self.assertEqual(f.readline(10), b"def\n") + self.assertEqual(f.readline(2), b"xy") + self.assertEqual(f.readline(4), b"zzy\n") + self.assertEqual(f.readline(), b"foo") + f.close() + def test_raw_bytes_io(self): f = io.BytesIO() self.write_ops(f) |