diff options
author | Giampaolo RodolĂ <g.rodola@gmail.com> | 2010-08-17 15:30:23 (GMT) |
---|---|---|
committer | Giampaolo RodolĂ <g.rodola@gmail.com> | 2010-08-17 15:30:23 (GMT) |
commit | ccfb91c89f9d7515356f31fff4af4c5cbd5eef7a (patch) | |
tree | bec4fcc901fce3653e504c5f24ca0983f2e1e861 /Lib | |
parent | 67b21b7547feee634bbecafeb88606ff350c0d3c (diff) | |
download | cpython-ccfb91c89f9d7515356f31fff4af4c5cbd5eef7a.zip cpython-ccfb91c89f9d7515356f31fff4af4c5cbd5eef7a.tar.gz cpython-ccfb91c89f9d7515356f31fff4af4c5cbd5eef7a.tar.bz2 |
fix issue #8866: parameters passed to socket.getaddrinfo can now be specified as single keyword arguments.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_socket.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index 48ba5f0..02c99b4 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -614,6 +614,28 @@ class GeneralModuleTests(unittest.TestCase): # usually do this socket.getaddrinfo(None, 0, socket.AF_UNSPEC, socket.SOCK_STREAM, 0, socket.AI_PASSIVE) + # test keyword arguments + a = socket.getaddrinfo(HOST, None) + b = socket.getaddrinfo(host=HOST, port=None) + self.assertEqual(a, b) + a = socket.getaddrinfo(HOST, None, socket.AF_INET) + b = socket.getaddrinfo(HOST, None, family=socket.AF_INET) + self.assertEqual(a, b) + a = socket.getaddrinfo(HOST, None, 0, socket.SOCK_STREAM) + b = socket.getaddrinfo(HOST, None, type=socket.SOCK_STREAM) + self.assertEqual(a, b) + a = socket.getaddrinfo(HOST, None, 0, 0, socket.SOL_TCP) + b = socket.getaddrinfo(HOST, None, proto=socket.SOL_TCP) + self.assertEqual(a, b) + a = socket.getaddrinfo(HOST, None, 0, 0, 0, socket.AI_PASSIVE) + b = socket.getaddrinfo(HOST, None, flags=socket.AI_PASSIVE) + self.assertEqual(a, b) + a = socket.getaddrinfo(None, 0, socket.AF_UNSPEC, socket.SOCK_STREAM, 0, + socket.AI_PASSIVE) + b = socket.getaddrinfo(host=None, port=0, family=socket.AF_UNSPEC, + type=socket.SOCK_STREAM, proto=0, + flags=socket.AI_PASSIVE) + self.assertEqual(a, b) @unittest.skipUnless(thread, 'Threading required for this test.') |