summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2014-02-20 03:56:35 (GMT)
committerBenjamin Peterson <benjamin@python.org>2014-02-20 03:56:35 (GMT)
commitf6218a21911a358e582805ef2c190b4c56caba7e (patch)
treef71c896e9bdec36a3aeee01d0deff7b00646d118
parentfbf648ebba32bbc5aa571a4b09e2062a65fd2492 (diff)
downloadcpython-f6218a21911a358e582805ef2c190b4c56caba7e.zip
cpython-f6218a21911a358e582805ef2c190b4c56caba7e.tar.gz
cpython-f6218a21911a358e582805ef2c190b4c56caba7e.tar.bz2
open retrieved file in binary mode, since it's now compressed
-rw-r--r--Lib/test/test_urllibnet.py6
1 files 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):