From 3246b1fe172ca3d4f098e85467234ded2f833b31 Mon Sep 17 00:00:00 2001 From: ContinuousFunction Date: Sun, 16 Nov 2014 16:39:08 -0800 Subject: [PATCH] Changed ConnectionError to InvalidURL --- requests/models.py | 2 +- test_requests.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/requests/models.py b/requests/models.py index b95b5bebde..8a71e28bab 100644 --- a/requests/models.py +++ b/requests/models.py @@ -354,7 +354,7 @@ def prepare_url(self, url, params): 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 6e49f0270c..d176ef45ad 100755 --- a/test_requests.py +++ b/test_requests.py @@ -310,8 +310,8 @@ def test_connection_error(self): 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):