diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-01-09 15:41:50 +0100 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-01-09 15:41:50 +0100 |
commit | 5473e038528e3b29db2dfc2b30370abc17ee1843 (patch) | |
tree | f1dc74ba5f8043383e98747faabe247c9ec39e79 /tests | |
parent | 15b5d58f450cd31e129d251e60356992eaa70955 (diff) | |
download | trollius-5473e038528e3b29db2dfc2b30370abc17ee1843.tar.gz |
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.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_streams.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_streams.py b/tests/test_streams.py index 05963cf..a18603a 100644 --- a/tests/test_streams.py +++ b/tests/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() |