diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-01-09 20:32:24 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-01-09 20:32:24 (GMT) |
commit | 3cd440df222776adca31d4a3003776edffa22317 (patch) | |
tree | 1db4c9ba9054d112527e53b6131a14c37efd4ea9 /Lib/test | |
parent | 02d845400275076ef5ba2791c74b7670ac21f8a9 (diff) | |
parent | 70db9e428aa476682ca80369d09a968b35729845 (diff) | |
download | cpython-3cd440df222776adca31d4a3003776edffa22317.zip cpython-3cd440df222776adca31d4a3003776edffa22317.tar.gz cpython-3cd440df222776adca31d4a3003776edffa22317.tar.bz2 |
Merge 3.4 (asyncio)
Diffstat (limited to 'Lib/test')
-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() |