diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-01-09 20:32:05 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-01-09 20:32:05 (GMT) |
commit | 70db9e428aa476682ca80369d09a968b35729845 (patch) | |
tree | 8ae8f3ec699f537280445f089804feac93bd35ae /Lib/test/test_asyncio/test_streams.py | |
parent | 7eb10311be26e8f353530ed79476d4c859243401 (diff) | |
download | cpython-70db9e428aa476682ca80369d09a968b35729845.zip cpython-70db9e428aa476682ca80369d09a968b35729845.tar.gz cpython-70db9e428aa476682ca80369d09a968b35729845.tar.bz2 |
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
Diffstat (limited to 'Lib/test/test_asyncio/test_streams.py')
-rw-r--r-- | Lib/test/test_asyncio/test_streams.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_streams.py b/Lib/test/test_asyncio/test_streams.py index 05963cf..a18603a 100644 --- a/Lib/test/test_asyncio/test_streams.py +++ b/Lib/test/test_asyncio/test_streams.py @@ -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() |