@@ -59,7 +59,9 @@ def test_country_ok(self, mock):
5959 self .base_uri + 'country/1.2.3.4' ,
6060 json = self .country ,
6161 status_code = 200 ,
62- headers = {'Content-Type' : self ._content_type ('country' )})
62+ headers = {
63+ 'Content-Type' : self ._content_type ('country' )
64+ })
6365 country = self .client .country ('1.2.3.4' )
6466 self .assertEqual (
6567 type (country ), geoip2 .models .Country ,
@@ -87,7 +89,9 @@ def test_me(self, mock):
8789 self .base_uri + 'country/me' ,
8890 json = self .country ,
8991 status_code = 200 ,
90- headers = {'Content-Type' : self ._content_type ('country' )})
92+ headers = {
93+ 'Content-Type' : self ._content_type ('country' )
94+ })
9195 implicit_me = self .client .country ()
9296 self .assertEqual (
9397 type (implicit_me ), geoip2 .models .Country ,
@@ -102,7 +106,9 @@ def test_200_error(self, mock):
102106 mock .get (
103107 self .base_uri + 'country/1.1.1.1' ,
104108 status_code = 200 ,
105- headers = {'Content-Type' : self ._content_type ('country' )})
109+ headers = {
110+ 'Content-Type' : self ._content_type ('country' )
111+ })
106112 with self .assertRaisesRegex (GeoIP2Error ,
107113 'could not decode the response as JSON' ):
108114 self .client .country ('1.1.1.1' )
@@ -119,7 +125,9 @@ def test_no_body_error(self, mock):
119125 self .base_uri + 'country/' + '1.2.3.7' ,
120126 text = '' ,
121127 status_code = 400 ,
122- headers = {'Content-Type' : self ._content_type ('country' )})
128+ headers = {
129+ 'Content-Type' : self ._content_type ('country' )
130+ })
123131 with self .assertRaisesRegex (
124132 HTTPError , 'Received a 400 error for .* with no body' ):
125133 self .client .country ('1.2.3.7' )
@@ -130,7 +138,9 @@ def test_weird_body_error(self, mock):
130138 self .base_uri + 'country/' + '1.2.3.8' ,
131139 text = '{"wierd": 42}' ,
132140 status_code = 400 ,
133- headers = {'Content-Type' : self ._content_type ('country' )})
141+ headers = {
142+ 'Content-Type' : self ._content_type ('country' )
143+ })
134144 with self .assertRaisesRegex (HTTPError ,
135145 'Response contains JSON but it does not '
136146 'specify code or error keys' ):
@@ -142,7 +152,9 @@ def test_bad_body_error(self, mock):
142152 self .base_uri + 'country/' + '1.2.3.9' ,
143153 text = 'bad body' ,
144154 status_code = 400 ,
145- headers = {'Content-Type' : self ._content_type ('country' )})
155+ headers = {
156+ 'Content-Type' : self ._content_type ('country' )
157+ })
146158 with self .assertRaisesRegex (
147159 HTTPError , 'it did not include the expected JSON body' ):
148160 self .client .country ('1.2.3.9' )
@@ -159,7 +171,9 @@ def test_300_error(self, mock):
159171 mock .get (
160172 self .base_uri + 'country/' + '1.2.3.11' ,
161173 status_code = 300 ,
162- headers = {'Content-Type' : self ._content_type ('country' )})
174+ headers = {
175+ 'Content-Type' : self ._content_type ('country' )
176+ })
163177 with self .assertRaisesRegex (HTTPError ,
164178 'Received a very surprising HTTP status '
165179 '\(300\) for' ):
@@ -214,7 +228,9 @@ def _test_error(self, mock, status, error_code, error_class):
214228 self .base_uri + 'country/1.2.3.18' ,
215229 json = body ,
216230 status_code = status ,
217- headers = {'Content-Type' : self ._content_type ('country' )})
231+ headers = {
232+ 'Content-Type' : self ._content_type ('country' )
233+ })
218234 with self .assertRaisesRegex (error_class , msg ):
219235 self .client .country ('1.2.3.18' )
220236
@@ -227,7 +243,9 @@ def test_unknown_error(self, mock):
227243 self .base_uri + 'country/' + ip ,
228244 json = body ,
229245 status_code = 400 ,
230- headers = {'Content-Type' : self ._content_type ('country' )})
246+ headers = {
247+ 'Content-Type' : self ._content_type ('country' )
248+ })
231249 with self .assertRaisesRegex (InvalidRequestError , msg ):
232250 self .client .country (ip )
233251
@@ -237,7 +255,9 @@ def test_request(self, mock):
237255 self .base_uri + 'country/' + '1.2.3.4' ,
238256 json = self .country ,
239257 status_code = 200 ,
240- headers = {'Content-Type' : self ._content_type ('country' )})
258+ headers = {
259+ 'Content-Type' : self ._content_type ('country' )
260+ })
241261 self .client .country ('1.2.3.4' )
242262 request = mock .request_history [- 1 ]
243263
@@ -256,7 +276,9 @@ def test_city_ok(self, mock):
256276 self .base_uri + 'city/' + '1.2.3.4' ,
257277 json = self .country ,
258278 status_code = 200 ,
259- headers = {'Content-Type' : self ._content_type ('city' )})
279+ headers = {
280+ 'Content-Type' : self ._content_type ('city' )
281+ })
260282 city = self .client .city ('1.2.3.4' )
261283 self .assertEqual (
262284 type (city ), geoip2 .models .City , 'return value of client.city' )
@@ -267,7 +289,9 @@ def test_insights_ok(self, mock):
267289 self .base_uri + 'insights/1.2.3.4' ,
268290 json = self .country ,
269291 status_code = 200 ,
270- headers = {'Content-Type' : self ._content_type ('country' )})
292+ headers = {
293+ 'Content-Type' : self ._content_type ('country' )
294+ })
271295 insights = self .client .insights ('1.2.3.4' )
272296 self .assertEqual (
273297 type (insights ), geoip2 .models .Insights ,
0 commit comments