diff options
author | Senthil Kumaran <senthil@uthcode.com> | 2014-04-14 20:32:20 (GMT) |
---|---|---|
committer | Senthil Kumaran <senthil@uthcode.com> | 2014-04-14 20:32:20 (GMT) |
commit | d8e24f1f716d32237f780e31c45431c5c458ff26 (patch) | |
tree | ea4ff5051faee077db392b3b670e05f0baa72c0c /Lib/urllib | |
parent | 01bafdcccc4ab653f70379a58a3183fac36e7132 (diff) | |
download | cpython-d8e24f1f716d32237f780e31c45431c5c458ff26.zip cpython-d8e24f1f716d32237f780e31c45431c5c458ff26.tar.gz cpython-d8e24f1f716d32237f780e31c45431c5c458ff26.tar.bz2 |
Convert urllib.request parse_proxy doctests to unittests.
Diffstat (limited to 'Lib/urllib')
-rw-r--r-- | Lib/urllib/request.py | 45 |
1 files changed, 1 insertions, 44 deletions
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py index 8a7d048..43d6caa 100644 --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -687,50 +687,7 @@ def _parse_proxy(proxy): If a URL is supplied, it must have an authority (host:port) component. According to RFC 3986, having an authority component means the URL must - have two slashes after the scheme: - - >>> _parse_proxy('file:/ftp.example.com/') - Traceback (most recent call last): - ValueError: proxy URL with no authority: 'file:/ftp.example.com/' - - The first three items of the returned tuple may be None. - - Examples of authority parsing: - - >>> _parse_proxy('proxy.example.com') - (None, None, None, 'proxy.example.com') - >>> _parse_proxy('proxy.example.com:3128') - (None, None, None, 'proxy.example.com:3128') - - The authority component may optionally include userinfo (assumed to be - username:password): - - >>> _parse_proxy('joe:password@proxy.example.com') - (None, 'joe', 'password', 'proxy.example.com') - >>> _parse_proxy('joe:password@proxy.example.com:3128') - (None, 'joe', 'password', 'proxy.example.com:3128') - - Same examples, but with URLs instead: - - >>> _parse_proxy('http://proxy.example.com/') - ('http', None, None, 'proxy.example.com') - >>> _parse_proxy('http://proxy.example.com:3128/') - ('http', None, None, 'proxy.example.com:3128') - >>> _parse_proxy('http://joe:password@proxy.example.com/') - ('http', 'joe', 'password', 'proxy.example.com') - >>> _parse_proxy('http://joe:password@proxy.example.com:3128') - ('http', 'joe', 'password', 'proxy.example.com:3128') - - Everything after the authority is ignored: - - >>> _parse_proxy('ftp://joe:password@proxy.example.com/rubbish:3128') - ('ftp', 'joe', 'password', 'proxy.example.com') - - Test for no trailing '/' case: - - >>> _parse_proxy('http://joe:password@proxy.example.com') - ('http', 'joe', 'password', 'proxy.example.com') - + have two slashes after the scheme. """ scheme, r_scheme = splittype(proxy) if not r_scheme.startswith("/"): |