Skip to content

Commit d7f20ce

Browse files
authored
Merge pull request #516 from s-t-e-v-e-n-k/python3.8-mime-type
MIME guessing works in Python 3.8 in test_urllib2
2 parents a3e303f + 9774207 commit d7f20ce

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tests/test_future/test_urllib2.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,10 @@ def connect_ftp(self, user, passwd, host, port, dirs,
691691
h = NullFTPHandler(data)
692692
h.parent = MockOpener()
693693

694+
# MIME guessing works in Python 3.8!
695+
guessed_mime = None
696+
if sys.hexversion >= 0x03080000:
697+
guessed_mime = "image/gif"
694698
for url, host, port, user, passwd, type_, dirs, filename, mimetype in [
695699
("ftp://localhost/foo/bar/baz.html",
696700
"localhost", ftplib.FTP_PORT, "", "", "I",
@@ -709,7 +713,7 @@ def connect_ftp(self, user, passwd, host, port, dirs,
709713
["foo", "bar"], "", None),
710714
("ftp://localhost/baz.gif;type=a",
711715
"localhost", ftplib.FTP_PORT, "", "", "A",
712-
[], "baz.gif", None), # XXX really this should guess image/gif
716+
[], "baz.gif", guessed_mime),
713717
]:
714718
req = Request(url)
715719
req.timeout = None

0 commit comments

Comments
 (0)