summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_urllib.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-08-29 01:53:26 (GMT)
committerGuido van Rossum <guido@python.org>2007-08-29 01:53:26 (GMT)
commit70d0ddab53208ee99af56610bda7302c4940e1c8 (patch)
tree3d21f6d7644fb68271bce50d3db46f173fb79603 /Lib/test/test_urllib.py
parent7436a063757bf19e7f8483c2d60349e227f33baf (diff)
downloadcpython-70d0ddab53208ee99af56610bda7302c4940e1c8.zip
cpython-70d0ddab53208ee99af56610bda7302c4940e1c8.tar.gz
cpython-70d0ddab53208ee99af56610bda7302c4940e1c8.tar.bz2
Make test_urllib be strict about str/bytes.
(One change to httplib.py, but not enough for test_httplib.)
Diffstat (limited to 'Lib/test/test_urllib.py')
-rw-r--r--Lib/test/test_urllib.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py
index dde5d58..875903e 100644
--- a/Lib/test/test_urllib.py
+++ b/Lib/test/test_urllib.py
@@ -30,7 +30,7 @@ class urlopen_FileTests(unittest.TestCase):
def setUp(self):
"""Setup of a temp file to use for testing"""
- self.text = bytes("test_urllib: %s\n" % self.__class__.__name__)
+ self.text = bytes("test_urllib: %s\n" % self.__class__.__name__, "ascii")
FILE = open(test_support.TESTFN, 'wb')
try:
FILE.write(self.text)
@@ -168,7 +168,7 @@ class urlretrieve_FileTests(unittest.TestCase):
def constructLocalFileUrl(self, filePath):
return "file://%s" % urllib.pathname2url(os.path.abspath(filePath))
- def createNewTempFile(self, data=""):
+ def createNewTempFile(self, data=b""):
"""Creates a new temporary file containing the specified data,
registers the file for deletion during the test fixture tear down, and
returns the absolute path of the file."""
@@ -246,7 +246,7 @@ class urlretrieve_FileTests(unittest.TestCase):
report = []
def hooktester(count, block_size, total_size, _report=report):
_report.append((count, block_size, total_size))
- srcFileName = self.createNewTempFile("x" * 5)
+ srcFileName = self.createNewTempFile(b"x" * 5)
urllib.urlretrieve(self.constructLocalFileUrl(srcFileName),
test_support.TESTFN, hooktester)
self.assertEqual(len(report), 2)
@@ -260,7 +260,7 @@ class urlretrieve_FileTests(unittest.TestCase):
report = []
def hooktester(count, block_size, total_size, _report=report):
_report.append((count, block_size, total_size))
- srcFileName = self.createNewTempFile("x" * 8193)
+ srcFileName = self.createNewTempFile(b"x" * 8193)
urllib.urlretrieve(self.constructLocalFileUrl(srcFileName),
test_support.TESTFN, hooktester)
self.assertEqual(len(report), 3)