diff options
author | Senthil Kumaran <senthil@uthcode.com> | 2012-12-24 22:00:20 (GMT) |
---|---|---|
committer | Senthil Kumaran <senthil@uthcode.com> | 2012-12-24 22:00:20 (GMT) |
commit | ed30199e7836ff52a101a9ea3a2b31f8455a85a8 (patch) | |
tree | 14b7178ceb041dd0271badb2d860fec4f0adb3cb /Lib/test | |
parent | 08bab072917c2eeea3a0f3da0546d57cf5072bcf (diff) | |
download | cpython-ed30199e7836ff52a101a9ea3a2b31f8455a85a8.zip cpython-ed30199e7836ff52a101a9ea3a2b31f8455a85a8.tar.gz cpython-ed30199e7836ff52a101a9ea3a2b31f8455a85a8.tar.bz2 |
Fix issue16713 - tel url parsing with params
Diffstat (limited to 'Lib/test')
-rwxr-xr-x | Lib/test/test_urlparse.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Lib/test/test_urlparse.py b/Lib/test/test_urlparse.py index e9adaef..378a427 100755 --- a/Lib/test/test_urlparse.py +++ b/Lib/test/test_urlparse.py @@ -818,6 +818,35 @@ class UrlParseTestCase(unittest.TestCase): p2 = urllib.parse.urlsplit('tel:+31641044153') self.assertEqual(p2.scheme, 'tel') self.assertEqual(p2.path, '+31641044153') + # assert the behavior for urlparse + p1 = urllib.parse.urlparse('tel:+31-641044153') + self.assertEqual(p1.scheme, 'tel') + self.assertEqual(p1.path, '+31-641044153') + p2 = urllib.parse.urlparse('tel:+31641044153') + self.assertEqual(p2.scheme, 'tel') + self.assertEqual(p2.path, '+31641044153') + + def test_telurl_params(self): + p1 = urllib.parse.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 = urllib.parse.urlparse('tel:+1-201-555-0123') + self.assertEqual(p1.scheme, 'tel') + self.assertEqual(p1.path, '+1-201-555-0123') + self.assertEqual(p1.params, '') + + p1 = urllib.parse.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 = urllib.parse.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_main(): support.run_unittest(UrlParseTestCase) |