Skip to content

Commit

Permalink
Fix URL parsing with Python 3.9, 3.8.1, and 3.7.6
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov committed Jul 18, 2020
1 parent c75a70a commit 3d5bf8f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGES/409.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix tests with newer Python (3.7.6, 3.8.1 and 3.9.0+).
16 changes: 13 additions & 3 deletions tests/test_url_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,19 @@ def test_scheme_only(self):

def test_no_scheme1(self):
u = URL("google.com:80")
assert u.scheme == ""
assert u.host is None
assert u.path == "google.com:80"
# See: https://bugs.python.org/issue27657
if (
sys.version_info[:3] == (3, 7, 6)
or sys.version_info[:3] == (3, 8, 1)
or sys.version_info >= (3, 9, 0)
):
assert u.scheme == "google.com"
assert u.host is None
assert u.path == "80"
else:
assert u.scheme == ""
assert u.host is None
assert u.path == "google.com:80"
assert u.query_string == ""
assert u.fragment == ""

Expand Down

0 comments on commit 3d5bf8f

Please sign in to comment.