Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 969b515

Browse files
Merge pull request sendgrid#82 from delirious-lettuce/fix_80
Fix sendgrid#80
2 parents ecb28e5 + 4ae4d97 commit 969b515

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

tests/test_unit.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import os
21
import pickle
3-
from os import path
2+
43
try:
54
import unittest2 as unittest
65
except ImportError:
76
import unittest
8-
from python_http_client.client import Client, Response
7+
from python_http_client.client import Client
98
from python_http_client.exceptions import (
109
handle_error,
1110
HTTPError,
@@ -15,15 +14,13 @@
1514
ServiceUnavailableError
1615
)
1716

18-
1917
try:
2018
# Python 3
2119
import urllib.request as urllib
2220
except ImportError:
2321
# Python 2
2422
import urllib2 as urllib
2523

26-
2724
try:
2825
basestring
2926
except NameError:
@@ -63,7 +60,7 @@ def __init__(self, host, response_code, timeout=None):
6360
Client.__init__(self, host)
6461

6562
def _make_request(self, opener, request, timeout=None):
66-
if 200 <= self.response_code < 299: # if successful code
63+
if 200 <= self.response_code < 299: # if successful code
6764
return MockResponse(self.response_code)
6865
else:
6966
raise handle_error(MockException(self.response_code))
@@ -76,7 +73,7 @@ def setUp(self):
7673
self.api_key = "SENDGRID_API_KEY"
7774
self.request_headers = {
7875
'Content-Type': 'application/json',
79-
'Authorization': 'Bearer ' + self.api_key,
76+
'Authorization': 'Bearer ' + self.api_key
8077
}
8178
self.client = Client(host=self.host,
8279
request_headers=self.request_headers,
@@ -154,7 +151,7 @@ def test__getattr__(self):
154151
self.assertEqual(client._version, 3)
155152

156153
# Test GET
157-
mock_client._url_path+['test']
154+
mock_client._url_path + ['test']
158155
r = mock_client.get()
159156
self.assertEqual(r.status_code, 200)
160157

@@ -191,11 +188,14 @@ def test__getattr__(self):
191188
mock_client.response_code = 523
192189
self.assertRaises(HTTPError, mock_client.delete)
193190

194-
195191
def test_client_pickle_unpickle(self):
196192
pickled_client = pickle.dumps(self.client)
197193
unpickled_client = pickle.loads(pickled_client)
198-
self.assertDictEqual(self.client.__dict__, unpickled_client.__dict__, "original client and unpickled client must have the same state")
194+
self.assertDictEqual(
195+
self.client.__dict__,
196+
unpickled_client.__dict__,
197+
"original client and unpickled client must have the same state"
198+
)
199199

200200

201201
if __name__ == '__main__':

0 commit comments

Comments
 (0)