diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-03-31 23:11:32 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-03-31 23:11:32 (GMT) |
commit | a1b49013f477e83bd1652f651f35c2e4eea54b67 (patch) | |
tree | e56aaae216ffdb72108a7131de3f2dd38ddc8244 /Lib/test | |
parent | d2ee64d9dd62942488a2f7fff18a21b87da7f7a9 (diff) | |
download | cpython-a1b49013f477e83bd1652f651f35c2e4eea54b67.zip cpython-a1b49013f477e83bd1652f651f35c2e4eea54b67.tar.gz cpython-a1b49013f477e83bd1652f651f35c2e4eea54b67.tar.bz2 |
fix TextIOWrapper.read() when the buffer is not readable #5628
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_io.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py index d5be405..53017f3 100644 --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -1754,6 +1754,13 @@ class TextIOWrapperTest(unittest.TestCase): self.assertEquals(f.read(), data * 2) self.assertEquals(buf.getvalue(), (data * 2).encode(encoding)) + def test_unreadable(self): + class UnReadable(self.BytesIO): + def readable(self): + return False + txt = self.TextIOWrapper(UnReadable()) + self.assertRaises(IOError, txt.read) + def test_read_one_by_one(self): txt = self.TextIOWrapper(self.BytesIO(b"AA\r\nBB")) reads = "" |