mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
(Merge 3.2) Issue #12175: RawIOBase.readall() now returns None if read()
returns None.
This commit is contained in:
commit
d2780aedce
4 changed files with 28 additions and 11 deletions
|
@ -833,14 +833,17 @@ class BufferedReaderTest(unittest.TestCase, CommonBufferedTests):
|
|||
# Inject some None's in there to simulate EWOULDBLOCK
|
||||
rawio = self.MockRawIO((b"abc", b"d", None, b"efg", None, None, None))
|
||||
bufio = self.tp(rawio)
|
||||
|
||||
self.assertEqual(b"abcd", bufio.read(6))
|
||||
self.assertEqual(b"e", bufio.read(1))
|
||||
self.assertEqual(b"fg", bufio.read())
|
||||
self.assertEqual(b"", bufio.peek(1))
|
||||
self.assertTrue(None is bufio.read())
|
||||
self.assertIsNone(bufio.read())
|
||||
self.assertEqual(b"", bufio.read())
|
||||
|
||||
rawio = self.MockRawIO((b"a", None, None))
|
||||
self.assertEqual(b"a", rawio.readall())
|
||||
self.assertIsNone(rawio.readall())
|
||||
|
||||
def test_read_past_eof(self):
|
||||
rawio = self.MockRawIO((b"abc", b"d", b"efg"))
|
||||
bufio = self.tp(rawio)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue