summaryrefslogtreecommitdiff
path: root/Lib/test/test_urlparse.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2008-01-05 01:21:57 +0000
committerGuido van Rossum <guido@python.org>2008-01-05 01:21:57 +0000
commitced4eb06e4fe528c99b34f4167011f8908c933af (patch)
tree81df17697d1f748fc75bc0c081104a932bf70bae /Lib/test/test_urlparse.py
parent3b83549ea0b0c3e8d1919925a8875052e13367cf (diff)
downloadcpython-git-ced4eb06e4fe528c99b34f4167011f8908c933af.tar.gz
Patch #1698 by Senthil: allow '@' in username when parsed by urlparse.py.
Diffstat (limited to 'Lib/test/test_urlparse.py')
-rw-r--r--Lib/test/test_urlparse.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_urlparse.py b/Lib/test/test_urlparse.py
index dcb89f763b..0df4058dc2 100644
--- a/Lib/test/test_urlparse.py
+++ b/Lib/test/test_urlparse.py
@@ -254,6 +254,24 @@ class UrlParseTestCase(unittest.TestCase):
self.assertEqual(p.port, 80)
self.assertEqual(p.geturl(), url)
+ # Addressing issue1698, which suggests Username can contain
+ # "@" character. Though not RFC complaint, many ftp sites allow
+ # and requests email ids as usernames.
+
+ url = "http://User@example.com:Pass@www.python.org:080/doc/?query=yes#frag"
+ p = urlparse.urlsplit(url)
+ self.assertEqual(p.scheme, "http")
+ self.assertEqual(p.netloc, "User@example.com:Pass@www.python.org:080")
+ self.assertEqual(p.path, "/doc/")
+ self.assertEqual(p.query, "query=yes")
+ self.assertEqual(p.fragment, "frag")
+ self.assertEqual(p.username, "User@example.com")
+ self.assertEqual(p.password, "Pass")
+ self.assertEqual(p.hostname, "www.python.org")
+ self.assertEqual(p.port, 80)
+ self.assertEqual(p.geturl(), url)
+
+
def test_attributes_bad_port(self):
"""Check handling of non-integer ports."""
p = urlparse.urlsplit("http://www.example.net:foo")