[Python-checkins] python/dist/src/Lib/test test_httplib.py, 1.15, 1.16

loewis at users.sourceforge.net loewis at users.sourceforge.net
Tue Sep 14 23:45:46 CEST 2004


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2020/Lib/test

Modified Files:
	test_httplib.py 
Log Message:
Strip square brackets from IPv6 address.


Index: test_httplib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_httplib.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- test_httplib.py	14 Sep 2004 17:55:21 -0000	1.15
+++ test_httplib.py	14 Sep 2004 21:45:36 -0000	1.16
@@ -118,12 +118,17 @@
         else:
             print "Expect InvalidURL"
 
-    for hp in ("[fe80::207:e9ff:fe9b]:8000", "www.python.org:80",
-               "www.python.org", "[fe80::207:e9ff:fe9b]"):
+    for hp,h,p in (("[fe80::207:e9ff:fe9b]:8000", "fe80::207:e9ff:fe9b", 8000), 
+                   ("www.python.org:80", "www.python.org", 80),
+                   ("www.python.org", "www.python.org", 80),
+	           ("[fe80::207:e9ff:fe9b]", "fe80::207:e9ff:fe9b", 80)):
         try:
-            h = httplib.HTTP(hp)
+            http = httplib.HTTP(hp)
         except httplib.InvalidURL:
             print "InvalidURL raised erroneously"
+	c = http._conn
+	if h != c.host: raise AssertionError, ("Host incorrectly parsed", h, c.host)
+	if p != c.port: raise AssertionError, ("Port incorrectly parsed", p, c.host)
 
     # test response with multiple message headers with the same field name.
     text = ('HTTP/1.1 200 OK\r\n'



More information about the Python-checkins mailing list