@@ -67,9 +67,7 @@ def test_country_ok(self, mock):
6767 self .base_uri + 'country/1.2.3.4' ,
6868 json = self .country ,
6969 status_code = 200 ,
70- headers = {
71- 'Content-Type' : self ._content_type ('country' )
72- })
70+ headers = {'Content-Type' : self ._content_type ('country' )})
7371 country = self .client .country ('1.2.3.4' )
7472 self .assertEqual (
7573 type (country ), geoip2 .models .Country ,
@@ -101,9 +99,7 @@ def test_me(self, mock):
10199 self .base_uri + 'country/me' ,
102100 json = self .country ,
103101 status_code = 200 ,
104- headers = {
105- 'Content-Type' : self ._content_type ('country' )
106- })
102+ headers = {'Content-Type' : self ._content_type ('country' )})
107103 implicit_me = self .client .country ()
108104 self .assertEqual (
109105 type (implicit_me ), geoip2 .models .Country ,
@@ -118,9 +114,7 @@ def test_200_error(self, mock):
118114 mock .get (
119115 self .base_uri + 'country/1.1.1.1' ,
120116 status_code = 200 ,
121- headers = {
122- 'Content-Type' : self ._content_type ('country' )
123- })
117+ headers = {'Content-Type' : self ._content_type ('country' )})
124118 with self .assertRaisesRegex (GeoIP2Error ,
125119 'could not decode the response as JSON' ):
126120 self .client .country ('1.1.1.1' )
@@ -137,9 +131,7 @@ def test_no_body_error(self, mock):
137131 self .base_uri + 'country/' + '1.2.3.7' ,
138132 text = '' ,
139133 status_code = 400 ,
140- headers = {
141- 'Content-Type' : self ._content_type ('country' )
142- })
134+ headers = {'Content-Type' : self ._content_type ('country' )})
143135 with self .assertRaisesRegex (
144136 HTTPError , 'Received a 400 error for .* with no body' ):
145137 self .client .country ('1.2.3.7' )
@@ -150,9 +142,7 @@ def test_weird_body_error(self, mock):
150142 self .base_uri + 'country/' + '1.2.3.8' ,
151143 text = '{"wierd": 42}' ,
152144 status_code = 400 ,
153- headers = {
154- 'Content-Type' : self ._content_type ('country' )
155- })
145+ headers = {'Content-Type' : self ._content_type ('country' )})
156146 with self .assertRaisesRegex (HTTPError ,
157147 'Response contains JSON but it does not '
158148 'specify code or error keys' ):
@@ -164,9 +154,7 @@ def test_bad_body_error(self, mock):
164154 self .base_uri + 'country/' + '1.2.3.9' ,
165155 text = 'bad body' ,
166156 status_code = 400 ,
167- headers = {
168- 'Content-Type' : self ._content_type ('country' )
169- })
157+ headers = {'Content-Type' : self ._content_type ('country' )})
170158 with self .assertRaisesRegex (
171159 HTTPError , 'it did not include the expected JSON body' ):
172160 self .client .country ('1.2.3.9' )
@@ -183,9 +171,7 @@ def test_300_error(self, mock):
183171 mock .get (
184172 self .base_uri + 'country/' + '1.2.3.11' ,
185173 status_code = 300 ,
186- headers = {
187- 'Content-Type' : self ._content_type ('country' )
188- })
174+ headers = {'Content-Type' : self ._content_type ('country' )})
189175 with self .assertRaisesRegex (HTTPError ,
190176 'Received a very surprising HTTP status '
191177 '\(300\) for' ):
@@ -248,9 +234,7 @@ def _test_error(self, mock, status, error_code, error_class):
248234 self .base_uri + 'country/1.2.3.18' ,
249235 json = body ,
250236 status_code = status ,
251- headers = {
252- 'Content-Type' : self ._content_type ('country' )
253- })
237+ headers = {'Content-Type' : self ._content_type ('country' )})
254238 with self .assertRaisesRegex (error_class , msg ):
255239 self .client .country ('1.2.3.18' )
256240
@@ -263,9 +247,7 @@ def test_unknown_error(self, mock):
263247 self .base_uri + 'country/' + ip ,
264248 json = body ,
265249 status_code = 400 ,
266- headers = {
267- 'Content-Type' : self ._content_type ('country' )
268- })
250+ headers = {'Content-Type' : self ._content_type ('country' )})
269251 with self .assertRaisesRegex (InvalidRequestError , msg ):
270252 self .client .country (ip )
271253
@@ -275,9 +257,7 @@ def test_request(self, mock):
275257 self .base_uri + 'country/' + '1.2.3.4' ,
276258 json = self .country ,
277259 status_code = 200 ,
278- headers = {
279- 'Content-Type' : self ._content_type ('country' )
280- })
260+ headers = {'Content-Type' : self ._content_type ('country' )})
281261 self .client .country ('1.2.3.4' )
282262 request = mock .request_history [- 1 ]
283263
@@ -296,9 +276,7 @@ def test_city_ok(self, mock):
296276 self .base_uri + 'city/' + '1.2.3.4' ,
297277 json = self .country ,
298278 status_code = 200 ,
299- headers = {
300- 'Content-Type' : self ._content_type ('city' )
301- })
279+ headers = {'Content-Type' : self ._content_type ('city' )})
302280 city = self .client .city ('1.2.3.4' )
303281 self .assertEqual (
304282 type (city ), geoip2 .models .City , 'return value of client.city' )
@@ -309,9 +287,7 @@ def test_insights_ok(self, mock):
309287 self .base_uri + 'insights/1.2.3.4' ,
310288 json = self .country ,
311289 status_code = 200 ,
312- headers = {
313- 'Content-Type' : self ._content_type ('country' )
314- })
290+ headers = {'Content-Type' : self ._content_type ('country' )})
315291 insights = self .client .insights ('1.2.3.4' )
316292 self .assertEqual (
317293 type (insights ), geoip2 .models .Insights ,
0 commit comments