diff options
author | Senthil Kumaran <orsenthil@gmail.com> | 2010-07-14 10:58:12 (GMT) |
---|---|---|
committer | Senthil Kumaran <orsenthil@gmail.com> | 2010-07-14 10:58:12 (GMT) |
commit | d76ec0fe4c2abd68a58a9388e7153ed954beb48a (patch) | |
tree | 91c89c4133623cbb4ebef5f22210763e0c6a3d24 /Lib/test/test_urlparse.py | |
parent | 3e4b1a2fdd3ca1fa70db9b96bdf7d9ecb38ec2fb (diff) | |
download | cpython-d76ec0fe4c2abd68a58a9388e7153ed954beb48a.zip cpython-d76ec0fe4c2abd68a58a9388e7153ed954beb48a.tar.gz cpython-d76ec0fe4c2abd68a58a9388e7153ed954beb48a.tar.bz2 |
Merged revisions 82883 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/release27-maint
................
r82883 | senthil.kumaran | 2010-07-14 16:09:35 +0530 (Wed, 14 Jul 2010) | 9 lines
Merged revisions 82881 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r82881 | senthil.kumaran | 2010-07-14 15:51:22 +0530 (Wed, 14 Jul 2010) | 3 lines
Fix Issue5842 - Moving the tests out of urllib.parse module
........
................
Diffstat (limited to 'Lib/test/test_urlparse.py')
-rw-r--r-- | Lib/test/test_urlparse.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Lib/test/test_urlparse.py b/Lib/test/test_urlparse.py index 0225e3b..c437ee0 100644 --- a/Lib/test/test_urlparse.py +++ b/Lib/test/test_urlparse.py @@ -7,6 +7,7 @@ import urlparse RFC1808_BASE = "http://a/b/c/d;p?q#f" RFC2396_BASE = "http://a/b/c/d;p?q" RFC3986_BASE = 'http://a/b/c/d;p?q' +SIMPLE_BASE = 'http://a/b/c/d' # A list of test cases. Each test case is a a two-tuple that contains # a string with the query and a dictionary with the expected result. @@ -291,6 +292,37 @@ class UrlParseTestCase(unittest.TestCase): #self.checkJoin(RFC3986_BASE, 'http:g','http:g') # strict parser self.checkJoin(RFC3986_BASE, 'http:g','http://a/b/c/g') #relaxed parser + def test_urljoins(self): + self.checkJoin(SIMPLE_BASE, 'g:h','g:h') + self.checkJoin(SIMPLE_BASE, 'http:g','http://a/b/c/g') + self.checkJoin(SIMPLE_BASE, 'http:','http://a/b/c/d') + self.checkJoin(SIMPLE_BASE, 'g','http://a/b/c/g') + self.checkJoin(SIMPLE_BASE, './g','http://a/b/c/g') + self.checkJoin(SIMPLE_BASE, 'g/','http://a/b/c/g/') + self.checkJoin(SIMPLE_BASE, '/g','http://a/g') + self.checkJoin(SIMPLE_BASE, '//g','http://g') + self.checkJoin(SIMPLE_BASE, '?y','http://a/b/c/d?y') + self.checkJoin(SIMPLE_BASE, 'g?y','http://a/b/c/g?y') + self.checkJoin(SIMPLE_BASE, 'g?y/./x','http://a/b/c/g?y/./x') + self.checkJoin(SIMPLE_BASE, '.','http://a/b/c/') + self.checkJoin(SIMPLE_BASE, './','http://a/b/c/') + self.checkJoin(SIMPLE_BASE, '..','http://a/b/') + self.checkJoin(SIMPLE_BASE, '../','http://a/b/') + self.checkJoin(SIMPLE_BASE, '../g','http://a/b/g') + self.checkJoin(SIMPLE_BASE, '../..','http://a/') + self.checkJoin(SIMPLE_BASE, '../../g','http://a/g') + self.checkJoin(SIMPLE_BASE, '../../../g','http://a/../g') + self.checkJoin(SIMPLE_BASE, './../g','http://a/b/g') + self.checkJoin(SIMPLE_BASE, './g/.','http://a/b/c/g/') + self.checkJoin(SIMPLE_BASE, '/./g','http://a/./g') + self.checkJoin(SIMPLE_BASE, 'g/./h','http://a/b/c/g/h') + self.checkJoin(SIMPLE_BASE, 'g/../h','http://a/b/c/h') + self.checkJoin(SIMPLE_BASE, 'http:g','http://a/b/c/g') + self.checkJoin(SIMPLE_BASE, 'http:','http://a/b/c/d') + self.checkJoin(SIMPLE_BASE, 'http:?y','http://a/b/c/d?y') + self.checkJoin(SIMPLE_BASE, 'http:g?y','http://a/b/c/g?y') + self.checkJoin(SIMPLE_BASE, 'http:g?y/./x','http://a/b/c/g?y/./x') + def test_urldefrag(self): for url, defrag, frag in [ ('http://python.org#frag', 'http://python.org', 'frag'), |