@@ -273,13 +273,13 @@ def test_DistanceToPointFilter_filtering(self):
273
273
distance = 5000 # meters
274
274
point_on_alcatraz = [- 122.4222 , 37.82667 ]
275
275
276
- url_params = '?dist=% 0.4f&point=hello&format=json' % ( distance ,)
276
+ url_params = f '?dist={ distance : 0.4f} &point=hello&format=json'
277
277
response = self .client .get (
278
- '%s%s' % ( self .location_within_distance_of_point_list_url , url_params )
278
+ f' { self .location_within_distance_of_point_list_url } { url_params } '
279
279
)
280
280
self .assertEqual (response .status_code , 400 )
281
281
282
- url_params = '?dist=% 0.4f&point=% 0.4f,% 0.4f&format=json' % (
282
+ url_params = '?dist={: 0.4f} &point={: 0.4f},{: 0.4f} &format=json' . format (
283
283
distance ,
284
284
point_on_alcatraz [0 ],
285
285
point_on_alcatraz [1 ],
@@ -298,21 +298,21 @@ def test_DistanceToPointFilter_filtering(self):
298
298
299
299
# Make sure we only get back the ones within the distance
300
300
response = self .client .get (
301
- '%s%s' % ( self .location_within_distance_of_point_list_url , url_params )
301
+ f' { self .location_within_distance_of_point_list_url } { url_params } '
302
302
)
303
303
self .assertEqual (len (response .data ['features' ]), 1 )
304
304
for result in response .data ['features' ]:
305
305
self .assertEqual (result ['properties' ]['name' ], treasure_island .name )
306
306
307
307
# Make sure we get back all the ones within the distance
308
308
distance = 7000
309
- url_params = '?dist=% 0.4f&point=% 0.4f,% 0.4f&format=json' % (
309
+ url_params = '?dist={: 0.4f} &point={: 0.4f},{: 0.4f} &format=json' . format (
310
310
distance ,
311
311
point_on_alcatraz [0 ],
312
312
point_on_alcatraz [1 ],
313
313
)
314
314
response = self .client .get (
315
- '%s%s' % ( self .location_within_distance_of_point_list_url , url_params )
315
+ f' { self .location_within_distance_of_point_list_url } { url_params } '
316
316
)
317
317
self .assertEqual (len (response .data ['features' ]), 2 )
318
318
for result in response .data ['features' ]:
@@ -322,7 +322,7 @@ def test_DistanceToPointFilter_filtering(self):
322
322
323
323
# Make sure we only get back the ones within the distance
324
324
degrees = 0.05
325
- url_params = '?dist=% 0.4f&point=% 0.4f,% 0.4f&format=json' % (
325
+ url_params = '?dist={: 0.4f} &point={: 0.4f},{: 0.4f} &format=json' . format (
326
326
degrees ,
327
327
point_on_alcatraz [0 ],
328
328
point_on_alcatraz [1 ],
@@ -347,7 +347,7 @@ def test_DistanceToPointOrderingFilter_filtering(self):
347
347
348
348
url_params = '?point=hello&format=json'
349
349
response = self .client .get (
350
- '%s%s' % ( self .location_order_distance_to_point , url_params )
350
+ f' { self .location_order_distance_to_point } { url_params } '
351
351
)
352
352
self .assertEqual (response .status_code , 400 )
353
353
@@ -380,7 +380,7 @@ def test_DistanceToPointOrderingFilter_filtering(self):
380
380
381
381
url_params = '?point=%i,%i&format=json' % (point [0 ], point [1 ])
382
382
response = self .client .get (
383
- '%s%s' % ( self .location_order_distance_to_point , url_params )
383
+ f' { self .location_order_distance_to_point } { url_params } '
384
384
)
385
385
self .assertEqual (len (response .data ['features' ]), 8 )
386
386
self .assertEqual (
@@ -399,7 +399,7 @@ def test_DistanceToPointOrderingFilter_filtering(self):
399
399
400
400
url_params = '?point=%i,%i&order=desc&format=json' % (point [0 ], point [1 ])
401
401
response = self .client .get (
402
- '%s%s' % ( self .location_order_distance_to_point , url_params )
402
+ f' { self .location_order_distance_to_point } { url_params } '
403
403
)
404
404
self .assertEqual (len (response .data ['features' ]), 8 )
405
405
self .assertEqual (
@@ -444,11 +444,9 @@ def test_GeometryField_filtering(self):
444
444
except AttributeError :
445
445
quoted_param = urllib .parse .quote (point_inside_ggpark_geojson )
446
446
447
- url_params = "?contains_properly=%s" % ( quoted_param ,)
447
+ url_params = f "?contains_properly={ quoted_param } "
448
448
449
- response = self .client .get (
450
- '{0}{1}' .format (self .geojson_contained_in_geometry , url_params )
451
- )
449
+ response = self .client .get (f'{ self .geojson_contained_in_geometry } { url_params } ' )
452
450
self .assertEqual (len (response .data ), 1 )
453
451
454
452
geometry_response = GEOSGeometry (json .dumps (response .data [0 ]['geometry' ]))
@@ -510,7 +508,7 @@ def test_TileFilter_ValueError(self):
510
508
def test_DistanceToPointFilter_filtering_none (self ):
511
509
url_params = '?dist=5000&point=&format=json'
512
510
response = self .client .get (
513
- '%s%s' % ( self .location_within_distance_of_point_list_url , url_params )
511
+ f' { self .location_within_distance_of_point_list_url } { url_params } '
514
512
)
515
513
self .assertDictEqual (
516
514
response .data , {'type' : 'FeatureCollection' , 'features' : []}
@@ -521,7 +519,7 @@ def test_DistanceToPointFilter_filter_field_none(self):
521
519
GeojsonLocationWithinDistanceOfPointList .distance_filter_field = None
522
520
url_params = '?dist=5000&point=&format=json'
523
521
response = self .client .get (
524
- '%s%s' % ( self .location_within_distance_of_point_list_url , url_params )
522
+ f' { self .location_within_distance_of_point_list_url } { url_params } '
525
523
)
526
524
self .assertDictEqual (
527
525
response .data , {'type' : 'FeatureCollection' , 'features' : []}
@@ -531,7 +529,7 @@ def test_DistanceToPointFilter_filter_field_none(self):
531
529
def test_DistanceToPointFilter_ValueError_point (self ):
532
530
url_params = '?dist=500.0&point=hello&format=json'
533
531
response = self .client .get (
534
- '%s%s' % ( self .location_within_distance_of_point_list_url , url_params )
532
+ f' { self .location_within_distance_of_point_list_url } { url_params } '
535
533
)
536
534
self .assertEqual (
537
535
response .data ['detail' ],
@@ -541,7 +539,7 @@ def test_DistanceToPointFilter_ValueError_point(self):
541
539
def test_DistanceToPointFilter_ValueError_distance (self ):
542
540
url_params = '?dist=wrong&point=12.0,42.0&format=json'
543
541
response = self .client .get (
544
- '%s%s' % ( self .location_within_distance_of_point_list_url , url_params )
542
+ f' { self .location_within_distance_of_point_list_url } { url_params } '
545
543
)
546
544
self .assertEqual (
547
545
response .data ['detail' ],
@@ -551,7 +549,7 @@ def test_DistanceToPointFilter_ValueError_distance(self):
551
549
def test_DistanceToPointOrderingFilter_filtering_none (self ):
552
550
url_params = '?point=&format=json'
553
551
response = self .client .get (
554
- '%s%s' % ( self .location_order_distance_to_point , url_params )
552
+ f' { self .location_order_distance_to_point } { url_params } '
555
553
)
556
554
self .assertDictEqual (
557
555
response .data , {'type' : 'FeatureCollection' , 'features' : []}
@@ -564,7 +562,7 @@ def test_DistanceToPointOrderingFilter_ordering_filter_field_none(self):
564
562
GeojsonLocationOrderDistanceToPointList .distance_ordering_filter_field = None
565
563
url_params = '?point=&format=json'
566
564
response = self .client .get (
567
- '%s%s' % ( self .location_order_distance_to_point , url_params )
565
+ f' { self .location_order_distance_to_point } { url_params } '
568
566
)
569
567
self .assertDictEqual (
570
568
response .data , {'type' : 'FeatureCollection' , 'features' : []}
0 commit comments