mirror of
https://github.com/python/cpython.git
synced 2025-07-24 03:35:53 +00:00
Merged revisions 80677 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r80677 | senthil.kumaran | 2010-05-01 13:59:18 +0530 (Sat, 01 May 2010) | 9 lines Merged revisions 80675 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r80675 | senthil.kumaran | 2010-05-01 13:31:56 +0530 (Sat, 01 May 2010) | 3 lines Fix issue8582: urllib.urlretrieve fails with ValueError: Invalid format string ........ ................
This commit is contained in:
parent
a751c3fcb8
commit
5a3bc6533c
2 changed files with 12 additions and 1 deletions
|
@ -8,6 +8,7 @@ import urllib.request
|
|||
import sys
|
||||
import os
|
||||
import email.message
|
||||
import time
|
||||
|
||||
|
||||
def _open_with_retry(func, host, *args, **kwargs):
|
||||
|
@ -180,6 +181,16 @@ class urlretrieveNetworkTests(unittest.TestCase):
|
|||
self.assertTrue(isinstance(header, email.message.Message),
|
||||
"header 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"
|
||||
file_location, fileheaders = self.urlretrieve(logo)
|
||||
os.unlink(file_location)
|
||||
datevalue = fileheaders.get('Date')
|
||||
dateformat = '%a, %d %b %Y %H:%M:%S GMT'
|
||||
try:
|
||||
time.strptime(datevalue, dateformat)
|
||||
except ValueError:
|
||||
self.fail('Date value not in %r format', dateformat)
|
||||
|
||||
|
||||
def test_main():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue