diff options
author | Yury Selivanov <yselivanov@sprymix.com> | 2016-06-02 20:51:27 (GMT) |
---|---|---|
committer | Yury Selivanov <yselivanov@sprymix.com> | 2016-06-02 20:51:27 (GMT) |
commit | 1f56e5f6afa137300d655a40e00675195e0248fe (patch) | |
tree | 21dc853305640b3332f51e90a169a8d7257102a0 /Lib/test | |
parent | 642afb3d3dcb5bcd359047d396343a1b3ca8370b (diff) | |
parent | a714616d36131860f4f3f18bc2cfaf9a578db053 (diff) | |
download | cpython-1f56e5f6afa137300d655a40e00675195e0248fe.zip cpython-1f56e5f6afa137300d655a40e00675195e0248fe.tar.gz cpython-1f56e5f6afa137300d655a40e00675195e0248fe.tar.bz2 |
Merge 3.5 (asyncio)
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_asyncio/test_base_events.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py index 81c35c8..e800ec4 100644 --- a/Lib/test/test_asyncio/test_base_events.py +++ b/Lib/test/test_asyncio/test_base_events.py @@ -146,6 +146,26 @@ class BaseEventTests(test_utils.TestCase): (INET, STREAM, TCP, '', ('1.2.3.4', 1)), base_events._ipaddr_info('1.2.3.4', b'1', INET, STREAM, TCP)) + def test_getaddrinfo_servname(self): + INET = socket.AF_INET + STREAM = socket.SOCK_STREAM + TCP = socket.IPPROTO_TCP + + self.assertEqual( + (INET, STREAM, TCP, '', ('1.2.3.4', 80)), + base_events._ipaddr_info('1.2.3.4', 'http', INET, STREAM, TCP)) + + self.assertEqual( + (INET, STREAM, TCP, '', ('1.2.3.4', 80)), + base_events._ipaddr_info('1.2.3.4', b'http', INET, STREAM, TCP)) + + # Raises "service/proto not found". + with self.assertRaises(OSError): + base_events._ipaddr_info('1.2.3.4', 'nonsense', INET, STREAM, TCP) + + with self.assertRaises(OSError): + base_events._ipaddr_info('1.2.3.4', 'nonsense', INET, STREAM, TCP) + @patch_socket def test_ipaddr_info_no_inet_pton(self, m_socket): del m_socket.inet_pton |