mirror of
https://github.com/python/cpython.git
synced 2025-09-25 01:43:11 +00:00
Fix issue16713 - tel url parsing with params
This commit is contained in:
parent
332562f447
commit
1974baadc6
3 changed files with 36 additions and 1 deletions
|
@ -446,10 +446,43 @@ class UrlParseTestCase(unittest.TestCase):
|
||||||
p1 = urlparse.urlsplit('tel:+31-641044153')
|
p1 = urlparse.urlsplit('tel:+31-641044153')
|
||||||
self.assertEqual(p1.scheme, 'tel')
|
self.assertEqual(p1.scheme, 'tel')
|
||||||
self.assertEqual(p1.path, '+31-641044153')
|
self.assertEqual(p1.path, '+31-641044153')
|
||||||
|
|
||||||
p2 = urlparse.urlsplit('tel:+31641044153')
|
p2 = urlparse.urlsplit('tel:+31641044153')
|
||||||
self.assertEqual(p2.scheme, 'tel')
|
self.assertEqual(p2.scheme, 'tel')
|
||||||
self.assertEqual(p2.path, '+31641044153')
|
self.assertEqual(p2.path, '+31641044153')
|
||||||
|
|
||||||
|
# Assert for urlparse
|
||||||
|
p1 = urlparse.urlparse('tel:+31-641044153')
|
||||||
|
self.assertEqual(p1.scheme, 'tel')
|
||||||
|
self.assertEqual(p1.path, '+31-641044153')
|
||||||
|
|
||||||
|
p2 = urlparse.urlparse('tel:+31641044153')
|
||||||
|
self.assertEqual(p2.scheme, 'tel')
|
||||||
|
self.assertEqual(p2.path, '+31641044153')
|
||||||
|
|
||||||
|
|
||||||
|
def test_telurl_params(self):
|
||||||
|
p1 = urlparse.urlparse('tel:123-4;phone-context=+1-650-516')
|
||||||
|
self.assertEqual(p1.scheme, 'tel')
|
||||||
|
self.assertEqual(p1.path, '123-4')
|
||||||
|
self.assertEqual(p1.params, 'phone-context=+1-650-516')
|
||||||
|
|
||||||
|
p1 = urlparse.urlparse('tel:+1-201-555-0123')
|
||||||
|
self.assertEqual(p1.scheme, 'tel')
|
||||||
|
self.assertEqual(p1.path, '+1-201-555-0123')
|
||||||
|
self.assertEqual(p1.params, '')
|
||||||
|
|
||||||
|
p1 = urlparse.urlparse('tel:7042;phone-context=example.com')
|
||||||
|
self.assertEqual(p1.scheme, 'tel')
|
||||||
|
self.assertEqual(p1.path, '7042')
|
||||||
|
self.assertEqual(p1.params, 'phone-context=example.com')
|
||||||
|
|
||||||
|
p1 = urlparse.urlparse('tel:863-1234;phone-context=+1-914-555')
|
||||||
|
self.assertEqual(p1.scheme, 'tel')
|
||||||
|
self.assertEqual(p1.path, '863-1234')
|
||||||
|
self.assertEqual(p1.params, 'phone-context=+1-914-555')
|
||||||
|
|
||||||
|
|
||||||
def test_attributes_bad_port(self):
|
def test_attributes_bad_port(self):
|
||||||
"""Check handling of non-integer ports."""
|
"""Check handling of non-integer ports."""
|
||||||
p = urlparse.urlsplit("http://www.example.net:foo")
|
p = urlparse.urlsplit("http://www.example.net:foo")
|
||||||
|
|
|
@ -42,7 +42,7 @@ uses_netloc = ['ftp', 'http', 'gopher', 'nntp', 'telnet',
|
||||||
'svn', 'svn+ssh', 'sftp','nfs','git', 'git+ssh']
|
'svn', 'svn+ssh', 'sftp','nfs','git', 'git+ssh']
|
||||||
uses_params = ['ftp', 'hdl', 'prospero', 'http', 'imap',
|
uses_params = ['ftp', 'hdl', 'prospero', 'http', 'imap',
|
||||||
'https', 'shttp', 'rtsp', 'rtspu', 'sip', 'sips',
|
'https', 'shttp', 'rtsp', 'rtspu', 'sip', 'sips',
|
||||||
'mms', '', 'sftp']
|
'mms', '', 'sftp', 'tel']
|
||||||
|
|
||||||
# These are not actually used anymore, but should stay for backwards
|
# These are not actually used anymore, but should stay for backwards
|
||||||
# compatibility. (They are undocumented, but have a public-looking name.)
|
# compatibility. (They are undocumented, but have a public-looking name.)
|
||||||
|
|
|
@ -164,6 +164,8 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #16713: Fix the parsing of tel url with params using urlparse module.
|
||||||
|
|
||||||
- Issue #16443: Add docstrings to regular expression match objects.
|
- Issue #16443: Add docstrings to regular expression match objects.
|
||||||
Patch by Anton Kasyanov.
|
Patch by Anton Kasyanov.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue