diff options
author | Matt Eaton <agnosticdev@gmail.com> | 2018-03-20 06:41:37 (GMT) |
---|---|---|
committer | Berker Peksag <berker.peksag@gmail.com> | 2018-03-20 06:41:37 (GMT) |
commit | 2cb4661707818cfd92556e7fdf9068a993577002 (patch) | |
tree | 0c3f6933e3e5117b5289845d998da35da46f8d72 /Lib/test/test_urlparse.py | |
parent | 7389fd935c95b4b6f094312294e703ee0de18719 (diff) | |
download | cpython-2cb4661707818cfd92556e7fdf9068a993577002.zip cpython-2cb4661707818cfd92556e7fdf9068a993577002.tar.gz cpython-2cb4661707818cfd92556e7fdf9068a993577002.tar.bz2 |
bpo-33034: Improve exception message when cast fails for {Parse,Split}Result.port (GH-6078)
Diffstat (limited to 'Lib/test/test_urlparse.py')
-rw-r--r-- | Lib/test/test_urlparse.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_urlparse.py b/Lib/test/test_urlparse.py index ddee1c3..9d51217 100644 --- a/Lib/test/test_urlparse.py +++ b/Lib/test/test_urlparse.py @@ -936,6 +936,16 @@ class UrlParseTestCase(unittest.TestCase): self.assertEqual(p2.scheme, 'tel') self.assertEqual(p2.path, '+31641044153') + def test_port_casting_failure_message(self): + message = "Port could not be cast to integer value as 'oracle'" + p1 = urllib.parse.urlparse('http://Server=sde; Service=sde:oracle') + with self.assertRaisesRegex(ValueError, message): + p1.port + + p2 = urllib.parse.urlsplit('http://Server=sde; Service=sde:oracle') + with self.assertRaisesRegex(ValueError, message): + p2.port + def test_telurl_params(self): p1 = urllib.parse.urlparse('tel:123-4;phone-context=+1-650-516') self.assertEqual(p1.scheme, 'tel') |