diff options
author | Srinivas Reddy Thatiparthy (శ్రీనివాస్ రెడ్డి తాటిపర్తి) <srinivasreddy@users.noreply.github.com> | 2017-12-30 15:09:32 (GMT) |
---|---|---|
committer | Andrew Svetlov <andrew.svetlov@gmail.com> | 2017-12-30 15:09:32 (GMT) |
commit | 1634fc289a13b0e1fdad4694d5cae7dab55f7186 (patch) | |
tree | 4973b8e55ffe557c712763c0be5a70946b9fd211 /Lib/test/test_asyncio | |
parent | fc35932afdad91f87b49a4854d4333267494c6c1 (diff) | |
download | cpython-1634fc289a13b0e1fdad4694d5cae7dab55f7186.zip cpython-1634fc289a13b0e1fdad4694d5cae7dab55f7186.tar.gz cpython-1634fc289a13b0e1fdad4694d5cae7dab55f7186.tar.bz2 |
bpo-32418: Add get_loop() method on Server, AbstractServer classes (#4997)
* Add abstract get_loop() method to Server, AbstractServer classes.
* Add test cases for get_loop() method in Server, AbstractServer classes
* Add documentation for get_loop() method
Diffstat (limited to 'Lib/test/test_asyncio')
-rw-r--r-- | Lib/test/test_asyncio/test_events.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py index da2e036..e832056 100644 --- a/Lib/test/test_asyncio/test_events.py +++ b/Lib/test/test_asyncio/test_events.py @@ -2826,6 +2826,19 @@ else: get_running_loop_impl = events._c_get_running_loop get_event_loop_impl = events._c_get_event_loop +class TestServer(unittest.TestCase): + + def test_get_loop(self): + loop = asyncio.new_event_loop() + proto = MyProto(loop) + server = loop.run_until_complete(loop.create_server(lambda: proto, '0.0.0.0', 0)) + self.assertEqual(server.get_loop(), loop) + loop.close() + +class TestAbstractServer(unittest.TestCase): + + def test_get_loop(self): + self.assertEqual(events.AbstractServer().get_loop(), NotImplemented) if __name__ == '__main__': unittest.main() |