From f6218a21911a358e582805ef2c190b4c56caba7e Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Wed, 19 Feb 2014 22:56:35 -0500 Subject: open retrieved file in binary mode, since it's now compressed --- Lib/test/test_urllibnet.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_urllibnet.py b/Lib/test/test_urllibnet.py index 383b2af..73ec90d 100644 --- a/Lib/test/test_urllibnet.py +++ b/Lib/test/test_urllibnet.py @@ -106,7 +106,7 @@ class urlopenNetworkTests(unittest.TestCase): # Make sure fd returned by fileno is valid. with self.urlopen("http://www.python.org/", timeout=None) as open_url: fd = open_url.fileno() - with os.fdopen(fd, encoding='utf-8') as f: + with os.fdopen(fd, 'rb') as f: self.assertTrue(f.read(), "reading from file created using fd " "returned by fileno failed") @@ -151,7 +151,7 @@ class urlretrieveNetworkTests(unittest.TestCase): with self.urlretrieve("http://www.python.org/") as (file_location, info): self.assertTrue(os.path.exists(file_location), "file location returned by" " urlretrieve is not a valid path") - with open(file_location, encoding='utf-8') as f: + with open(file_location, 'rb') as f: self.assertTrue(f.read(), "reading from the file location returned" " by urlretrieve failed") @@ -161,7 +161,7 @@ class urlretrieveNetworkTests(unittest.TestCase): support.TESTFN) as (file_location, info): self.assertEqual(file_location, support.TESTFN) self.assertTrue(os.path.exists(file_location)) - with open(file_location, encoding='utf-8') as f: + with open(file_location, 'rb') as f: self.assertTrue(f.read(), "reading from temporary file failed") def test_header(self): -- cgit v0.12 From 1b94030b370db589286c731c708ab7742a918055 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Wed, 19 Feb 2014 22:55:16 -0500 Subject: update logo url (#20695) --- Lib/test/test_urllibnet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_urllibnet.py b/Lib/test/test_urllibnet.py index 73ec90d..573c0c1 100644 --- a/Lib/test/test_urllibnet.py +++ b/Lib/test/test_urllibnet.py @@ -171,7 +171,7 @@ class urlretrieveNetworkTests(unittest.TestCase): "info is not an instance of email.message.Message") def test_data_header(self): - logo = "http://www.python.org/community/logos/python-logo-master-v3-TM.png" + logo = "http://www.python.org/static/community_logos/python-logo-master-v3-TM.png" with self.urlretrieve(logo) as (file_location, fileheaders): datevalue = fileheaders.get('Date') dateformat = '%a, %d %b %Y %H:%M:%S GMT' -- cgit v0.12