aboutsummaryrefslogtreecommitdiff
path: root/test/test_exceptions.py
blob: 3e02ca682becc34c1215623c7009336323214078 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import unittest
import pickle

from urllib3.exceptions import HTTPError, MaxRetryError, LocationParseError
from urllib3.connectionpool import HTTPConnectionPool



class TestPickle(unittest.TestCase):

    def test_exceptions(self):
        assert pickle.dumps(HTTPError(None))
        assert pickle.dumps(MaxRetryError(None, None, None))
        assert pickle.dumps(LocationParseError(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'))