diff options
author | Senthil Kumaran <orsenthil@gmail.com> | 2010-07-14 10:21:22 (GMT) |
---|---|---|
committer | Senthil Kumaran <orsenthil@gmail.com> | 2010-07-14 10:21:22 (GMT) |
commit | aa69d4d00fa2eeb0fd5bafec284cac34f4ba869b (patch) | |
tree | 5ac12bc87f1aff8c0f3e89ce08ab7ed478f5c37e /Lib/urllib | |
parent | fc9e08de3a05149c7f0b2334d88a7b80ca4063e3 (diff) | |
download | cpython-aa69d4d00fa2eeb0fd5bafec284cac34f4ba869b.zip cpython-aa69d4d00fa2eeb0fd5bafec284cac34f4ba869b.tar.gz cpython-aa69d4d00fa2eeb0fd5bafec284cac34f4ba869b.tar.bz2 |
Fix Issue5842 - Moving the tests out of urllib.parse module
Diffstat (limited to 'Lib/urllib')
-rw-r--r-- | Lib/urllib/parse.py | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py index c6ebcc9..82edea1 100644 --- a/Lib/urllib/parse.py +++ b/Lib/urllib/parse.py @@ -799,67 +799,3 @@ def splitvalue(attr): match = _valueprog.match(attr) if match: return match.group(1, 2) return attr, None - -test_input = """ - http://a/b/c/d - - g:h = <URL:g:h> - http:g = <URL:http://a/b/c/g> - http: = <URL:http://a/b/c/d> - g = <URL:http://a/b/c/g> - ./g = <URL:http://a/b/c/g> - g/ = <URL:http://a/b/c/g/> - /g = <URL:http://a/g> - //g = <URL:http://g> - ?y = <URL:http://a/b/c/d?y> - g?y = <URL:http://a/b/c/g?y> - g?y/./x = <URL:http://a/b/c/g?y/./x> - . = <URL:http://a/b/c/> - ./ = <URL:http://a/b/c/> - .. = <URL:http://a/b/> - ../ = <URL:http://a/b/> - ../g = <URL:http://a/b/g> - ../.. = <URL:http://a/> - ../../g = <URL:http://a/g> - ../../../g = <URL:http://a/../g> - ./../g = <URL:http://a/b/g> - ./g/. = <URL:http://a/b/c/g/> - /./g = <URL:http://a/./g> - g/./h = <URL:http://a/b/c/g/h> - g/../h = <URL:http://a/b/c/h> - http:g = <URL:http://a/b/c/g> - http: = <URL:http://a/b/c/d> - http:?y = <URL:http://a/b/c/d?y> - http:g?y = <URL:http://a/b/c/g?y> - http:g?y/./x = <URL:http://a/b/c/g?y/./x> -""" - -def test(): - base = '' - if sys.argv[1:]: - fn = sys.argv[1] - if fn == '-': - fp = sys.stdin - else: - fp = open(fn) - else: - from io import StringIO - fp = StringIO(test_input) - for line in fp: - words = line.split() - if not words: - continue - url = words[0] - parts = urlparse(url) - print('%-10s : %s' % (url, parts)) - abs = urljoin(base, url) - if not base: - base = abs - wrapped = '<URL:%s>' % abs - print('%-10s = %s' % (url, wrapped)) - if len(words) == 3 and words[1] == '=': - if wrapped != words[2]: - print('EXPECTED', words[2], '!!!!!!!!!!') - -if __name__ == '__main__': - test() |