Skip to content

MIME guessing works in Python 3.8 in test_urllib2 #516

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 24, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion tests/test_future/test_urllib2.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,10 @@ def connect_ftp(self, user, passwd, host, port, dirs,
h = NullFTPHandler(data)
h.parent = MockOpener()

# MIME guessing works in Python 3.8!
guessed_mime = None
if sys.hexversion >= 0x03080000:
guessed_mime = "image/gif"
for url, host, port, user, passwd, type_, dirs, filename, mimetype in [
("ftp://localhost/foo/bar/baz.html",
"localhost", ftplib.FTP_PORT, "", "", "I",
Expand All @@ -709,7 +713,7 @@ def connect_ftp(self, user, passwd, host, port, dirs,
["foo", "bar"], "", None),
("ftp://localhost/baz.gif;type=a",
"localhost", ftplib.FTP_PORT, "", "", "A",
[], "baz.gif", None), # XXX really this should guess image/gif
[], "baz.gif", guessed_mime),
]:
req = Request(url)
req.timeout = None
Expand Down