summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_urlparse.py
diff options
context:
space:
mode:
authorSenthil Kumaran <orsenthil@gmail.com>2010-07-14 10:21:22 (GMT)
committerSenthil Kumaran <orsenthil@gmail.com>2010-07-14 10:21:22 (GMT)
commitaa69d4d00fa2eeb0fd5bafec284cac34f4ba869b (patch)
tree5ac12bc87f1aff8c0f3e89ce08ab7ed478f5c37e /Lib/test/test_urlparse.py
parentfc9e08de3a05149c7f0b2334d88a7b80ca4063e3 (diff)
downloadcpython-aa69d4d00fa2eeb0fd5bafec284cac34f4ba869b.zip
cpython-aa69d4d00fa2eeb0fd5bafec284cac34f4ba869b.tar.gz
cpython-aa69d4d00fa2eeb0fd5bafec284cac34f4ba869b.tar.bz2
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.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/Lib/test/test_urlparse.py b/Lib/test/test_urlparse.py
index 400decd..69d65c1 100644
--- a/Lib/test/test_urlparse.py
+++ b/Lib/test/test_urlparse.py
@@ -7,6 +7,7 @@ import urllib.parse
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.
@@ -295,6 +296,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_RFC2732(self):
for url, hostname, port in [
('http://Test.python.org:5432/foo/', 'test.python.org', 5432),