From: ContinuousFunction Date: Mon, 17 Nov 2014 00:39:08 +0000 (-0800) Subject: Changed ConnectionError to InvalidURL X-Git-Tag: v2.5.1~4^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3246b1fe172ca3d4f098e85467234ded2f833b31;p=services%2Fpython-requests.git Changed ConnectionError to InvalidURL --- diff --git a/requests/models.py b/requests/models.py index b95b5be..8a71e28 100644 --- a/requests/models.py +++ b/requests/models.py @@ -354,7 +354,7 @@ class PreparedRequest(RequestEncodingMixin, RequestHooksMixin): try: scheme, auth, host, port, path, query, fragment = parse_url(url) except LocationParseError as e: - raise ConnectionError(e.message) + raise InvalidURL(e.message) if not scheme: raise MissingSchema("Invalid URL {0!r}: No schema supplied. " diff --git a/test_requests.py b/test_requests.py index 6e49f02..d176ef4 100755 --- a/test_requests.py +++ b/test_requests.py @@ -310,8 +310,8 @@ class RequestsTestCase(unittest.TestCase): requests.get("http://httpbin.org:1") def test_LocationParseError(self): - """Inputing a URL that cannot be parsed should raise a ConnectionError""" - with pytest.raises(ConnectionError): + """Inputing a URL that cannot be parsed should raise an InvalidURL error""" + with pytest.raises(InvalidURL): requests.get("http://fe80::5054:ff:fe5a:fc0") def test_basicauth_with_netrc(self):