diff options
author | ContinuousFunction <evolutionace@gmail.com> | 2014-11-16 16:39:08 -0800 |
---|---|---|
committer | ContinuousFunction <evolutionace@gmail.com> | 2014-11-17 20:06:24 -0800 |
commit | 3246b1fe172ca3d4f098e85467234ded2f833b31 (patch) | |
tree | d18e0c9be75ba6c7319d5e2c9d134502fff21562 | |
parent | 087a27aba97d3eac017d321e37bf1970f8833c1a (diff) | |
download | python-requests-3246b1fe172ca3d4f098e85467234ded2f833b31.tar.gz |
Changed ConnectionError to InvalidURL
-rw-r--r-- | requests/models.py | 2 | ||||
-rwxr-xr-x | test_requests.py | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/requests/models.py b/requests/models.py index b95b5beb..8a71e28b 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 6e49f027..d176ef45 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): |