Changed ConnectionError to InvalidURL
authorContinuousFunction <evolutionace@gmail.com>
Mon, 17 Nov 2014 00:39:08 +0000 (16:39 -0800)
committerContinuousFunction <evolutionace@gmail.com>
Tue, 18 Nov 2014 04:06:24 +0000 (20:06 -0800)
requests/models.py
test_requests.py

index b95b5bebde33f216b409f843f090980ec830d3a6..8a71e28babb15620521d248a9672bebc46fee27c 100644 (file)
@@ -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. "
index 6e49f0270c31bd8fc8350d378a466c231c5503ed..d176ef45adb39d9249e8327e4e45f3b0b4727749 100755 (executable)
@@ -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):