Skip to content

Commit

Permalink
Merge 6a5235a into 5393dbe
Browse files Browse the repository at this point in the history
  • Loading branch information
shadchin authored Jul 7, 2023
2 parents 5393dbe + 6a5235a commit 8abe8ee
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/test_url.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
import os
import unittest
from inspect import isclass
Expand Down Expand Up @@ -102,7 +103,7 @@
if (
chr(value) not in _C0_CONTROL_OR_SPACE
and chr(value) not in USERINFO_SAFE
and chr(value) not in ":/?#\\"
and chr(value) not in ":/?#\\[]"
)
)
USERNAME_ENCODED = "".join(f"%{ord(char):02X}" for char in USERNAME_TO_ENCODE)
Expand Down Expand Up @@ -386,7 +387,6 @@ def test_safe_url_string_encoding(
"http://192.168.0.256", # Invalid IP address
"http://192.168.0.0.0", # Invalid IP address / domain name
"http://[2a01:5cc0:1:2::4]", # https://github.com/scrapy/w3lib/issues/193
"http://[2a01:5cc0:1:2:3:4]", # Invalid IPv6
"https://example.com:", # Removes the :
# Does not convert \ to /
"https://example.com\\a",
Expand Down Expand Up @@ -418,6 +418,8 @@ def test_safe_url_string_encoding(
# (%) are not escaped.
f"a://example.com#{FRAGMENT_TO_ENCODE}",
}
if sys.version_info < (3, 11, 4):
KNOWN_SAFE_URL_STRING_URL_ISSUES.add("http://[2a01:5cc0:1:2:3:4]") # Invalid IPv6


@pytest.mark.parametrize(
Expand Down

0 comments on commit 8abe8ee

Please sign in to comment.