Commit c03e6df1 authored by Jelte Jansen's avatar Jelte Jansen
Browse files

[1298] update tests

parent 45bd3908
...@@ -2179,26 +2179,33 @@ class TestFormatting(unittest.TestCase): ...@@ -2179,26 +2179,33 @@ class TestFormatting(unittest.TestCase):
# (family, sockettype, (address, port)) # (family, sockettype, (address, port))
# of which sockettype is ignored # of which sockettype is ignored
self.assertEqual("192.0.2.1:53", self.assertEqual("192.0.2.1:53",
format_addrinfo((socket.AF_INET, None, format_addrinfo((socket.AF_INET, socket.SOCK_STREAM,
("192.0.2.1", 53)))) ("192.0.2.1", 53))))
self.assertEqual("192.0.2.2:53", self.assertEqual("192.0.2.2:53",
format_addrinfo((socket.AF_INET, None, format_addrinfo((socket.AF_INET, socket.SOCK_STREAM,
("192.0.2.2", 53)))) ("192.0.2.2", 53))))
self.assertEqual("192.0.2.1:54", self.assertEqual("192.0.2.1:54",
format_addrinfo((socket.AF_INET, None, format_addrinfo((socket.AF_INET, socket.SOCK_STREAM,
("192.0.2.1", 54)))) ("192.0.2.1", 54))))
self.assertEqual("[::1]:53", self.assertEqual("[2001:db8::1]:53",
format_addrinfo((socket.AF_INET6, None, format_addrinfo((socket.AF_INET6, socket.SOCK_STREAM,
("::1", 53)))) ("2001:db8::1", 53))))
self.assertEqual("[::2]:53", self.assertEqual("[2001:db8::2]:53",
format_addrinfo((socket.AF_INET6, None, format_addrinfo((socket.AF_INET6, socket.SOCK_STREAM,
("::2", 53)))) ("2001:db8::2", 53))))
self.assertEqual("[::1]:54", self.assertEqual("[2001:db8::1]:54",
format_addrinfo((socket.AF_INET6, None, format_addrinfo((socket.AF_INET6, socket.SOCK_STREAM,
("::1", 54)))) ("2001:db8::1", 54))))
self.assertEqual("/some/file", self.assertEqual("/some/file",
format_addrinfo((socket.AF_UNIX, None, format_addrinfo((socket.AF_UNIX, socket.SOCK_STREAM,
"/some/file"))) "/some/file")))
# second element of passed tuple should be ignored
self.assertEqual("192.0.2.1:53",
format_addrinfo((socket.AF_INET, None,
("192.0.2.1", 53))))
self.assertEqual("192.0.2.1:53",
format_addrinfo((socket.AF_INET, "Just some string",
("192.0.2.1", 53))))
self.assertRaises(TypeError, format_addrinfo, 1) self.assertRaises(TypeError, format_addrinfo, 1)
self.assertRaises(TypeError, format_addrinfo, self.assertRaises(TypeError, format_addrinfo,
(socket.AF_INET, "asdf")) (socket.AF_INET, "asdf"))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment