diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-02-13 08:24:37 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-02-13 08:24:37 (GMT) |
commit | 28773465e699b4a9a2e6411de80fb06d2652d3e3 (patch) | |
tree | 9f0c79dd40fbda255c523149ccffb2e1e7c43e4e /Lib/test/test_asyncio/test_events.py | |
parent | 7dfaa27fddb57ffcaf79bf21c49fd2a2cd741ab9 (diff) | |
download | cpython-28773465e699b4a9a2e6411de80fb06d2652d3e3.zip cpython-28773465e699b4a9a2e6411de80fb06d2652d3e3.tar.gz cpython-28773465e699b4a9a2e6411de80fb06d2652d3e3.tar.bz2 |
ayncio, Tulip issue 129: BaseEventLoop.sock_connect() now raises an error if
the address is not resolved (hostname instead of an IP address) for AF_INET and
AF_INET6 address families.
Diffstat (limited to 'Lib/test/test_asyncio/test_events.py')
-rw-r--r-- | Lib/test/test_asyncio/test_events.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py index d5d667a..4300ddd 100644 --- a/Lib/test/test_asyncio/test_events.py +++ b/Lib/test/test_asyncio/test_events.py @@ -1191,6 +1191,18 @@ class EventLoopTestsMixin: {'clock_resolution': self.loop._clock_resolution, 'selector': self.loop._selector.__class__.__name__}) + def test_sock_connect_address(self): + address = ('www.python.org', 80) + for family in (socket.AF_INET, socket.AF_INET6): + for sock_type in (socket.SOCK_STREAM, socket.SOCK_DGRAM): + sock = socket.socket(family, sock_type) + with sock: + connect = self.loop.sock_connect(sock, address) + with self.assertRaises(ValueError) as cm: + self.loop.run_until_complete(connect) + self.assertIn('address must be resolved', + str(cm.exception)) + class SubprocessTestsMixin: |