aboutsummaryrefslogtreecommitdiff
path: root/test/test_exceptions.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_exceptions.py')
-rw-r--r--test/test_exceptions.py30
1 files changed, 23 insertions, 7 deletions
diff --git a/test/test_exceptions.py b/test/test_exceptions.py
index 3e02ca6..e20649b 100644
--- a/test/test_exceptions.py
+++ b/test/test_exceptions.py
@@ -1,19 +1,35 @@
import unittest
import pickle
-from urllib3.exceptions import HTTPError, MaxRetryError, LocationParseError
+from urllib3.exceptions import (HTTPError, MaxRetryError, LocationParseError,
+ ClosedPoolError, EmptyPoolError,
+ HostChangedError, ReadTimeoutError,
+ ConnectTimeoutError)
from urllib3.connectionpool import HTTPConnectionPool
class TestPickle(unittest.TestCase):
+ def cycle(self, item):
+ return pickle.loads(pickle.dumps(item))
+
def test_exceptions(self):
- assert pickle.dumps(HTTPError(None))
- assert pickle.dumps(MaxRetryError(None, None, None))
- assert pickle.dumps(LocationParseError(None))
+ assert self.cycle(HTTPError(None))
+ assert self.cycle(MaxRetryError(None, None, None))
+ assert self.cycle(LocationParseError(None))
+ assert self.cycle(ConnectTimeoutError(None))
def test_exceptions_with_objects(self):
- assert pickle.dumps(HTTPError('foo'))
- assert pickle.dumps(MaxRetryError(HTTPConnectionPool('localhost'), '/', None))
- assert pickle.dumps(LocationParseError('fake location'))
+ assert self.cycle(HTTPError('foo'))
+ assert self.cycle(MaxRetryError(HTTPConnectionPool('localhost'),
+ '/', None))
+ assert self.cycle(LocationParseError('fake location'))
+ assert self.cycle(ClosedPoolError(HTTPConnectionPool('localhost'),
+ None))
+ assert self.cycle(EmptyPoolError(HTTPConnectionPool('localhost'),
+ None))
+ assert self.cycle(HostChangedError(HTTPConnectionPool('localhost'),
+ '/', None))
+ assert self.cycle(ReadTimeoutError(HTTPConnectionPool('localhost'),
+ '/', None))