diff options
author | Senthil Kumaran <senthil@uthcode.com> | 2012-12-24 21:56:54 (GMT) |
---|---|---|
committer | Senthil Kumaran <senthil@uthcode.com> | 2012-12-24 21:56:54 (GMT) |
commit | 1974baadc62a6c95db9c96fa482377df98ce36cc (patch) | |
tree | d54cd529e8a11fec4b7376ecb258140be9ff608e /Lib/test | |
parent | 332562f44790556cdd4cb909a3a90052a12a6fc0 (diff) | |
download | cpython-1974baadc62a6c95db9c96fa482377df98ce36cc.zip cpython-1974baadc62a6c95db9c96fa482377df98ce36cc.tar.gz cpython-1974baadc62a6c95db9c96fa482377df98ce36cc.tar.bz2 |
Fix issue16713 - tel url parsing with params
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_urlparse.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Lib/test/test_urlparse.py b/Lib/test/test_urlparse.py index 3f316d3..72ebfaa 100644 --- a/Lib/test/test_urlparse.py +++ b/Lib/test/test_urlparse.py @@ -446,10 +446,43 @@ class UrlParseTestCase(unittest.TestCase): p1 = urlparse.urlsplit('tel:+31-641044153') self.assertEqual(p1.scheme, 'tel') self.assertEqual(p1.path, '+31-641044153') + p2 = urlparse.urlsplit('tel:+31641044153') self.assertEqual(p2.scheme, 'tel') 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): """Check handling of non-integer ports.""" p = urlparse.urlsplit("http://www.example.net:foo") |