Skip to content

Commit 3d5bf8f

Browse files
committed
Fix URL parsing with Python 3.9, 3.8.1, and 3.7.6
1 parent c75a70a commit 3d5bf8f

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

CHANGES/409.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix tests with newer Python (3.7.6, 3.8.1 and 3.9.0+).

tests/test_url_parsing.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,19 @@ def test_scheme_only(self):
4040

4141
def test_no_scheme1(self):
4242
u = URL("google.com:80")
43-
assert u.scheme == ""
44-
assert u.host is None
45-
assert u.path == "google.com:80"
43+
# See: https://bugs.python.org/issue27657
44+
if (
45+
sys.version_info[:3] == (3, 7, 6)
46+
or sys.version_info[:3] == (3, 8, 1)
47+
or sys.version_info >= (3, 9, 0)
48+
):
49+
assert u.scheme == "google.com"
50+
assert u.host is None
51+
assert u.path == "80"
52+
else:
53+
assert u.scheme == ""
54+
assert u.host is None
55+
assert u.path == "google.com:80"
4656
assert u.query_string == ""
4757
assert u.fragment == ""
4858

0 commit comments

Comments
 (0)