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 | 1b0580b3203281e700ab3df10e6d117796f9d955 (patch) | |
tree | 1f6d56d1d8b275d73c08e0824da2a4ee017db449 /Lib/test | |
parent | 2303fecedcfbdec16999e054e401dfad3a13fc05 (diff) | |
download | cpython-1b0580b3203281e700ab3df10e6d117796f9d955.zip cpython-1b0580b3203281e700ab3df10e6d117796f9d955.tar.gz cpython-1b0580b3203281e700ab3df10e6d117796f9d955.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')
-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: |