mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
asyncio: sync with Tulip
* Tulip issue 184: FlowControlMixin constructor now get the event loop if the loop parameter is not set. Add unit tests to ensure that constructor of StreamReader and StreamReaderProtocol classes get the event loop. * Remove outdated TODO/XXX
This commit is contained in:
parent
7eb10311be
commit
70db9e428a
6 changed files with 29 additions and 11 deletions
|
@ -625,6 +625,25 @@ os.close(fd)
|
|||
data = self.loop.run_until_complete(reader.read(-1))
|
||||
self.assertEqual(data, b'data')
|
||||
|
||||
def test_streamreader_constructor(self):
|
||||
self.addCleanup(asyncio.set_event_loop, None)
|
||||
asyncio.set_event_loop(self.loop)
|
||||
|
||||
# Tulip issue #184: Ensure that StreamReaderProtocol constructor
|
||||
# retrieves the current loop if the loop parameter is not set
|
||||
reader = asyncio.StreamReader()
|
||||
self.assertIs(reader._loop, self.loop)
|
||||
|
||||
def test_streamreaderprotocol_constructor(self):
|
||||
self.addCleanup(asyncio.set_event_loop, None)
|
||||
asyncio.set_event_loop(self.loop)
|
||||
|
||||
# Tulip issue #184: Ensure that StreamReaderProtocol constructor
|
||||
# retrieves the current loop if the loop parameter is not set
|
||||
reader = mock.Mock()
|
||||
protocol = asyncio.StreamReaderProtocol(reader)
|
||||
self.assertIs(protocol._loop, self.loop)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue