@@ -274,13 +274,13 @@ def test_DistanceToPointFilter_filtering(self):
274274 distance = 5000 # meters
275275 point_on_alcatraz = [- 122.4222 , 37.82667 ]
276276
277- url_params = '?dist=% 0.4f&point=hello&format=json' % ( distance ,)
277+ url_params = f '?dist={ distance : 0.4f} &point=hello&format=json'
278278 response = self .client .get (
279- '%s%s' % ( self .location_within_distance_of_point_list_url , url_params )
279+ f' { self .location_within_distance_of_point_list_url } { url_params } '
280280 )
281281 self .assertEqual (response .status_code , 400 )
282282
283- url_params = '?dist=% 0.4f&point=% 0.4f,% 0.4f&format=json' % (
283+ url_params = '?dist={: 0.4f} &point={: 0.4f},{: 0.4f} &format=json' . format (
284284 distance ,
285285 point_on_alcatraz [0 ],
286286 point_on_alcatraz [1 ],
@@ -299,21 +299,21 @@ def test_DistanceToPointFilter_filtering(self):
299299
300300 # Make sure we only get back the ones within the distance
301301 response = self .client .get (
302- '%s%s' % ( self .location_within_distance_of_point_list_url , url_params )
302+ f' { self .location_within_distance_of_point_list_url } { url_params } '
303303 )
304304 self .assertEqual (len (response .data ['features' ]), 1 )
305305 for result in response .data ['features' ]:
306306 self .assertEqual (result ['properties' ]['name' ], treasure_island .name )
307307
308308 # Make sure we get back all the ones within the distance
309309 distance = 7000
310- url_params = '?dist=% 0.4f&point=% 0.4f,% 0.4f&format=json' % (
310+ url_params = '?dist={: 0.4f} &point={: 0.4f},{: 0.4f} &format=json' . format (
311311 distance ,
312312 point_on_alcatraz [0 ],
313313 point_on_alcatraz [1 ],
314314 )
315315 response = self .client .get (
316- '%s%s' % ( self .location_within_distance_of_point_list_url , url_params )
316+ f' { self .location_within_distance_of_point_list_url } { url_params } '
317317 )
318318 self .assertEqual (len (response .data ['features' ]), 2 )
319319 for result in response .data ['features' ]:
@@ -323,7 +323,7 @@ def test_DistanceToPointFilter_filtering(self):
323323
324324 # Make sure we only get back the ones within the distance
325325 degrees = 0.05
326- url_params = '?dist=% 0.4f&point=% 0.4f,% 0.4f&format=json' % (
326+ url_params = '?dist={: 0.4f} &point={: 0.4f},{: 0.4f} &format=json' . format (
327327 degrees ,
328328 point_on_alcatraz [0 ],
329329 point_on_alcatraz [1 ],
@@ -348,7 +348,7 @@ def test_DistanceToPointOrderingFilter_filtering(self):
348348
349349 url_params = '?point=hello&format=json'
350350 response = self .client .get (
351- '%s%s' % ( self .location_order_distance_to_point , url_params )
351+ f' { self .location_order_distance_to_point } { url_params } '
352352 )
353353 self .assertEqual (response .status_code , 400 )
354354
@@ -381,7 +381,7 @@ def test_DistanceToPointOrderingFilter_filtering(self):
381381
382382 url_params = '?point=%i,%i&format=json' % (point [0 ], point [1 ])
383383 response = self .client .get (
384- '%s%s' % ( self .location_order_distance_to_point , url_params )
384+ f' { self .location_order_distance_to_point } { url_params } '
385385 )
386386 self .assertEqual (len (response .data ['features' ]), 8 )
387387 self .assertEqual (
@@ -400,7 +400,7 @@ def test_DistanceToPointOrderingFilter_filtering(self):
400400
401401 url_params = '?point=%i,%i&order=desc&format=json' % (point [0 ], point [1 ])
402402 response = self .client .get (
403- '%s%s' % ( self .location_order_distance_to_point , url_params )
403+ f' { self .location_order_distance_to_point } { url_params } '
404404 )
405405 self .assertEqual (len (response .data ['features' ]), 8 )
406406 self .assertEqual (
@@ -445,11 +445,9 @@ def test_GeometryField_filtering(self):
445445 except AttributeError :
446446 quoted_param = urllib .parse .quote (point_inside_ggpark_geojson )
447447
448- url_params = "?contains_properly=%s" % ( quoted_param ,)
448+ url_params = f "?contains_properly={ quoted_param } "
449449
450- response = self .client .get (
451- '{0}{1}' .format (self .geojson_contained_in_geometry , url_params )
452- )
450+ response = self .client .get (f'{ self .geojson_contained_in_geometry } { url_params } ' )
453451 self .assertEqual (len (response .data ), 1 )
454452
455453 geometry_response = GEOSGeometry (json .dumps (response .data [0 ]['geometry' ]))
@@ -511,7 +509,7 @@ def test_TileFilter_ValueError(self):
511509 def test_DistanceToPointFilter_filtering_none (self ):
512510 url_params = '?dist=5000&point=&format=json'
513511 response = self .client .get (
514- '%s%s' % ( self .location_within_distance_of_point_list_url , url_params )
512+ f' { self .location_within_distance_of_point_list_url } { url_params } '
515513 )
516514 self .assertDictEqual (
517515 response .data , {'type' : 'FeatureCollection' , 'features' : []}
@@ -522,7 +520,7 @@ def test_DistanceToPointFilter_filter_field_none(self):
522520 GeojsonLocationWithinDistanceOfPointList .distance_filter_field = None
523521 url_params = '?dist=5000&point=&format=json'
524522 response = self .client .get (
525- '%s%s' % ( self .location_within_distance_of_point_list_url , url_params )
523+ f' { self .location_within_distance_of_point_list_url } { url_params } '
526524 )
527525 self .assertDictEqual (
528526 response .data , {'type' : 'FeatureCollection' , 'features' : []}
@@ -532,7 +530,7 @@ def test_DistanceToPointFilter_filter_field_none(self):
532530 def test_DistanceToPointFilter_ValueError_point (self ):
533531 url_params = '?dist=500.0&point=hello&format=json'
534532 response = self .client .get (
535- '%s%s' % ( self .location_within_distance_of_point_list_url , url_params )
533+ f' { self .location_within_distance_of_point_list_url } { url_params } '
536534 )
537535 self .assertEqual (
538536 response .data ['detail' ],
@@ -542,7 +540,7 @@ def test_DistanceToPointFilter_ValueError_point(self):
542540 def test_DistanceToPointFilter_ValueError_distance (self ):
543541 url_params = '?dist=wrong&point=12.0,42.0&format=json'
544542 response = self .client .get (
545- '%s%s' % ( self .location_within_distance_of_point_list_url , url_params )
543+ f' { self .location_within_distance_of_point_list_url } { url_params } '
546544 )
547545 self .assertEqual (
548546 response .data ['detail' ],
@@ -552,7 +550,7 @@ def test_DistanceToPointFilter_ValueError_distance(self):
552550 def test_DistanceToPointOrderingFilter_filtering_none (self ):
553551 url_params = '?point=&format=json'
554552 response = self .client .get (
555- '%s%s' % ( self .location_order_distance_to_point , url_params )
553+ f' { self .location_order_distance_to_point } { url_params } '
556554 )
557555 self .assertDictEqual (
558556 response .data , {'type' : 'FeatureCollection' , 'features' : []}
@@ -565,7 +563,7 @@ def test_DistanceToPointOrderingFilter_ordering_filter_field_none(self):
565563 GeojsonLocationOrderDistanceToPointList .distance_ordering_filter_field = None
566564 url_params = '?point=&format=json'
567565 response = self .client .get (
568- '%s%s' % ( self .location_order_distance_to_point , url_params )
566+ f' { self .location_order_distance_to_point } { url_params } '
569567 )
570568 self .assertDictEqual (
571569 response .data , {'type' : 'FeatureCollection' , 'features' : []}
0 commit comments