+9
-8
lines changedFilter options
+9
-8
lines changed Original file line number Diff line number Diff line change
@@ -1018,11 +1018,12 @@ def test_urlsplit_normalization(self):
1018
1018
urllib.parse.urlsplit('http://\u30d5\u309a\ufe1380')
1019
1019
1020
1020
for scheme in ["http", "https", "ftp"]:
1021
-
for c in denorm_chars:
1022
-
url = "{}://netloc{}false.netloc/path".format(scheme, c)
1023
-
with self.subTest(url=url, char='{:04X}'.format(ord(c))):
1024
-
with self.assertRaises(ValueError):
1025
-
urllib.parse.urlsplit(url)
1021
+
for netloc in ["netloc{}false.netloc", "n{}user@netloc"]:
1022
+
for c in denorm_chars:
1023
+
url = "{}://{}/path".format(scheme, netloc.format(c))
1024
+
with self.subTest(url=url, char='{:04X}'.format(ord(c))):
1025
+
with self.assertRaises(ValueError):
1026
+
urllib.parse.urlsplit(url)
1026
1027
1027
1028
class Utility_Tests(unittest.TestCase):
1028
1029
"""Testcase to test the various utility functions in the urllib."""
Original file line number Diff line number Diff line change
@@ -402,9 +402,9 @@ def _checknetloc(netloc):
402
402
# looking for characters like \u2100 that expand to 'a/c'
403
403
# IDNA uses NFKC equivalence, so normalize for this check
404
404
import unicodedata
405
-
n = netloc.rpartition('@')[2] # ignore anything to the left of '@'
406
-
n = n.replace(':', '') # ignore characters already included
407
-
n = n.replace('#', '') # but not the surrounding text
405
+
n = netloc.replace('@', '') # ignore characters already included
406
+
n = n.replace(':', '') # but not the surrounding text
407
+
n = n.replace('#', '')
408
408
n = n.replace('?', '')
409
409
netloc2 = unicodedata.normalize('NFKC', n)
410
410
if n == netloc2:
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4