mirror of
https://github.com/python/cpython.git
synced 2025-12-10 11:00:14 +00:00
amk's fix attached to
[ 516299 ] urlparse can get fragments wrong
This commit is contained in:
parent
5c137c2251
commit
bd3e771a97
3 changed files with 26 additions and 1 deletions
|
|
@ -4,6 +4,24 @@ errors = 0
|
|||
|
||||
RFC1808_BASE = "http://a/b/c/d;p?q#f"
|
||||
|
||||
for url, expected in [('http://www.python.org',
|
||||
('http', 'www.python.org', '', '', '', '')),
|
||||
('http://www.python.org#abc',
|
||||
('http', 'www.python.org', '', '', '', 'abc')),
|
||||
('http://www.python.org/#abc',
|
||||
('http', 'www.python.org', '/', '', '', 'abc')),
|
||||
(RFC1808_BASE,
|
||||
('http', 'a', '/b/c/d', 'p', 'q', 'f')),
|
||||
]:
|
||||
result = urlparse.urlparse(url)
|
||||
print "%-13s = %r" % (url, result)
|
||||
if result != expected:
|
||||
errors += 1
|
||||
print "urlparse(%r)" % url
|
||||
print ("expected %r,\n"
|
||||
" got %r") % (expected, result)
|
||||
print
|
||||
|
||||
def checkJoin(relurl, expected):
|
||||
global errors
|
||||
result = urlparse.urljoin(RFC1808_BASE, relurl)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue