|  | 
| 3 | 3 | import unittest | 
| 4 | 4 | import urllib.parse | 
| 5 | 5 | from test import support | 
|  | 6 | +from strings import ascii_letters, digits | 
| 6 | 7 | 
 | 
| 7 | 8 | RFC1808_BASE = "http://a/b/c/d;p?q#f" | 
| 8 | 9 | RFC2396_BASE = "http://a/b/c/d;p?q" | 
| @@ -1419,6 +1420,17 @@ def test_invalid_bracketed_hosts(self): | 
| 1419 | 1420 |         self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix]v6a.ip[suffix') | 
| 1420 | 1421 |         self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix]v6a.ip') | 
| 1421 | 1422 |         self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://v6a.ip[suffix') | 
|  | 1423 | +        # unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" | 
|  | 1424 | +        unreserved = ascii_letters + digits + "-" + "." + "_" + "~" | 
|  | 1425 | +        # sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "=" | 
|  | 1426 | +        sub_delims = "!" + "$" + "&" + "'" + "(" + ")" + "*" + "+" + "," + ";" + "=" | 
|  | 1427 | +        ipvfuture_authorized_characters = unreserved + sub_delims + ":" | 
|  | 1428 | +        removed_characters = "\t\n\r" | 
|  | 1429 | +        for character in range(256): | 
|  | 1430 | +            character = chr(character) | 
|  | 1431 | +            if character in ipvfuture_authorized_characters or character in removed_characters: | 
|  | 1432 | +                continue | 
|  | 1433 | +            self.assertRaises(ValueError, urllib.parse.urlsplit, f'scheme://[v7.invalid{character}invalid]/') | 
| 1422 | 1434 | 
 | 
| 1423 | 1435 |     def test_splitting_bracketed_hosts(self): | 
| 1424 | 1436 |         p1 = urllib.parse.urlsplit('scheme://user@[v6a.ip]:1234/path?query') | 
|  | 
0 commit comments