]> granicus.if.org Git - python/commitdiff
merge from 3.1
authorSenthil Kumaran <orsenthil@gmail.com>
Tue, 12 Apr 2011 23:22:29 +0000 (07:22 +0800)
committerSenthil Kumaran <orsenthil@gmail.com>
Tue, 12 Apr 2011 23:22:29 +0000 (07:22 +0800)
1  2 
Lib/test/test_urllib.py
Lib/test/test_urllib2.py
Lib/test/test_urllib2net.py
Lib/urllib/request.py

index 11e5dad5bf5aea37d4fdba0ba45b9eb7e42acb23,462a2b03f83428dfc0b4321fa331470911e23e26..275b2eb81e90e3e003a4ae88cc8f5cda959f9833
@@@ -175,25 -171,16 +175,35 @@@ class urlopen_HttpTests(unittest.TestCa
          finally:
              self.unfakehttp()
  
 -        self.fakehttp(b'Hello!')
+     def test_url_fragment(self):
+         # Issue #11703: geturl() omits fragments in the original URL.
+         url = 'http://docs.python.org/library/urllib.html#OK'
++        self.fakehttp(b"HTTP/1.1 200 OK\r\n\r\nHello!")
+         try:
+             fp = urllib.request.urlopen(url)
+             self.assertEqual(fp.geturl(), url)
+         finally:
+             self.unfakehttp()
 +    def test_willclose(self):
 +        self.fakehttp(b"HTTP/1.1 200 OK\r\n\r\nHello!")
 +        try:
 +            resp = urlopen("http://www.python.org")
 +            self.assertTrue(resp.fp.will_close)
 +        finally:
 +            self.unfakehttp()
 +
 +    def test_read_0_9(self):
 +        # "0.9" response accepted (but not "simple responses" without
 +        # a status line)
 +        self.check_read(b"0.9")
 +
 +    def test_read_1_0(self):
 +        self.check_read(b"1.0")
 +
 +    def test_read_1_1(self):
 +        self.check_read(b"1.1")
 +
      def test_read_bogus(self):
          # urlopen() should raise IOError for many error codes.
          self.fakehttp(b'''HTTP/1.1 401 Authentication Required
Simple merge
Simple merge
Simple merge