Patch for issue 2848, mostly by Humberto Diogenes, with a couple of

small fixes by Barry.  This removes mimetools from the stdlib.
This commit is contained in:
Barry Warsaw 2008-06-12 04:06:45 +00:00
parent 75f25f2c9a
commit 820c120059
23 changed files with 146 additions and 202 deletions

View file

@ -7,7 +7,7 @@ import socket
import urllib
import sys
import os
import mimetools
import email.message
def _open_with_retry(func, host, *args, **kwargs):
@ -87,10 +87,10 @@ class urlopenNetworkTests(unittest.TestCase):
info_obj = open_url.info()
finally:
open_url.close()
self.assert_(isinstance(info_obj, mimetools.Message),
self.assert_(isinstance(info_obj, email.message.Message),
"object returned by 'info' is not an instance of "
"mimetools.Message")
self.assertEqual(info_obj.getsubtype(), "html")
"email.message.Message")
self.assertEqual(info_obj.get_content_subtype(), "html")
def test_geturl(self):
# Make sure same URL as opened is returned by geturl.
@ -180,8 +180,8 @@ class urlretrieveNetworkTests(unittest.TestCase):
# Make sure header returned as 2nd value from urlretrieve is good.
file_location, header = self.urlretrieve("http://www.python.org/")
os.unlink(file_location)
self.assert_(isinstance(header, mimetools.Message),
"header is not an instance of mimetools.Message")
self.assert_(isinstance(header, email.message.Message),
"header is not an instance of email.message.Message")