@@ -238,56 +238,56 @@ def test_circle_marker(self):
238
238
bounds = self .map .get_bounds ()
239
239
assert bounds == [[45.6 , - 122.9 ], [45.7 , - 122.8 ]], bounds
240
240
241
-
242
241
def test_rectangle_marker (self ):
243
242
"""Test rectangle marker additions."""
244
243
245
244
self .map = folium .Map (location = [45.60 , - 122.8 ])
246
245
rect_templ = self .env .get_template ('rectangle_marker.js' )
247
246
248
247
# Single Rectangle marker.
249
- self .map .add_child (folium .RectangleMarker (bounds = [45.60 , - 122.8 , 45.61 , - 122.7 ], popup = 'Hi' ))
248
+ bounds = [45.60 , - 122.8 , 45.61 , - 122.7 ]
249
+ self .map .add_child (folium .RectangleMarker (bounds = bounds , popup = 'Hi' ))
250
250
marker = list (self .map ._children .values ())[- 1 ]
251
251
rect_1 = rect_templ .render ({'RectangleMarker' : marker .get_name (),
252
- 'location' : [45.60 , - 122.8 ,45.61 , - 122.7 ],
253
- 'color' : 'black' ,
254
- 'fill_color' : 'black' ,
255
- 'fill_opacity' : 0.6 ,
256
- 'weight' : 1 })
252
+ 'location' : [45.60 , - 122.8 , 45.61 , - 122.7 ],
253
+ 'color' : 'black' ,
254
+ 'fill_color' : 'black' ,
255
+ 'fill_opacity' : 0.6 ,
256
+ 'weight' : 1 })
257
257
assert ('' .join (rect_1 .split ())[:- 1 ] in
258
258
'' .join (self .map .get_root ().render ().split ()))
259
259
260
260
# Second Rectangle marker.
261
- self .map .add_child (folium .RectangleMarker (bounds = [45.70 , - 122.9 , 45.75 , - 122.5 ], popup = 'Hi' ))
261
+ bounds = [45.70 , - 122.9 , 45.75 , - 122.5 ]
262
+ self .map .add_child (folium .RectangleMarker (bounds = bounds , popup = 'Hi' ))
262
263
marker = list (self .map ._children .values ())[- 1 ]
263
264
rect_2 = rect_templ .render ({'RectangleMarker' : marker .get_name (),
264
- 'location' : [45.70 , - 122.9 ,45.75 , - 122.5 ],
265
- 'color' : 'black' ,
266
- 'fill_color' : 'black' ,
267
- 'fill_opacity' : 0.6 ,
268
- 'weight' : 1 })
265
+ 'location' : [45.70 , - 122.9 , 45.75 , - 122.5 ],
266
+ 'color' : 'black' ,
267
+ 'fill_color' : 'black' ,
268
+ 'fill_opacity' : 0.6 ,
269
+ 'weight' : 1 })
269
270
assert ('' .join (rect_2 .split ())[:- 1 ] in
270
271
'' .join (self .map .get_root ().render ().split ()))
271
272
272
273
bounds = self .map .get_bounds ()
273
274
assert bounds == [[45.6 , - 122.9 ], [45.7 , - 122.8 ]], bounds
274
275
275
-
276
276
def test_polygon (self ):
277
277
"""Test polygon additions."""
278
278
279
279
self .map = folium .Map (location = [45.60 , - 122.8 ])
280
280
polygon_templ = self .env .get_template ('polygon.js' )
281
281
282
282
# Single Polygon.
283
- locations = [[35.6636 , 139.7634 ],
284
- [35.6629 , 139.7664 ],
285
- [35.6663 , 139.7706 ],
286
- [35.6725 , 139.7632 ],
287
- [35.6728 , 139.7627 ],
288
- [35.6720 , 139.7606 ],
289
- [35.6682 , 139.7588 ],
290
- [35.6663 , 139.7627 ]]
283
+ locations = [[35.6636 , 139.7634 ],
284
+ [35.6629 , 139.7664 ],
285
+ [35.6663 , 139.7706 ],
286
+ [35.6725 , 139.7632 ],
287
+ [35.6728 , 139.7627 ],
288
+ [35.6720 , 139.7606 ],
289
+ [35.6682 , 139.7588 ],
290
+ [35.6663 , 139.7627 ]]
291
291
self .map .add_child (folium .Polygon (locations = locations , popup = 'Hi' ))
292
292
marker = list (self .map ._children .values ())[- 1 ]
293
293
polygon_1 = polygon_templ .render ({'Polygon' : marker .get_name (),
@@ -300,28 +300,30 @@ def test_polygon(self):
300
300
'' .join (self .map .get_root ().render ().split ()))
301
301
302
302
# Second Polygon.
303
- locations = [[35.5636 , 138.7634 ],
304
- [35.5629 , 138.7664 ],
305
- [35.5663 , 138.7706 ],
306
- [35.5725 , 138.7632 ],
307
- [35.5728 , 138.7627 ],
308
- [35.5720 , 138.7606 ],
309
- [35.5682 , 138.7588 ],
310
- [35.5663 , 138.7627 ]]
311
- self .map .add_child (folium .Polygon (locations = locations , color = 'red' , fill_color = 'red' ,
312
- fill_opacity = 0.7 , weight = 3 , popup = 'Hi' ))
303
+ locations = [[35.5636 , 138.7634 ],
304
+ [35.5629 , 138.7664 ],
305
+ [35.5663 , 138.7706 ],
306
+ [35.5725 , 138.7632 ],
307
+ [35.5728 , 138.7627 ],
308
+ [35.5720 , 138.7606 ],
309
+ [35.5682 , 138.7588 ],
310
+ [35.5663 , 138.7627 ]]
311
+ self .map .add_child (folium .Polygon (locations = locations , color = 'red' ,
312
+ fill_color = 'red' , fill_opacity = 0.7 ,
313
+ weight = 3 , popup = 'Hi' ))
313
314
marker = list (self .map ._children .values ())[- 1 ]
314
315
polygon_2 = polygon_templ .render ({'Polygon' : marker .get_name (),
315
- 'location' : locations ,
316
- 'color' : 'red' ,
317
- 'fill_color' : 'red' ,
318
- 'fill_opacity' : 0.7 ,
319
- 'weight' : 3 })
316
+ 'location' : locations ,
317
+ 'color' : 'red' ,
318
+ 'fill_color' : 'red' ,
319
+ 'fill_opacity' : 0.7 ,
320
+ 'weight' : 3 })
320
321
assert ('' .join (polygon_2 .split ())[:- 1 ] in
321
322
'' .join (self .map .get_root ().render ().split ()))
322
323
323
324
bounds = self .map .get_bounds ()
324
- assert bounds == [[[35.5636 , 138.7634 ], [35.5629 , 138.7664 ]], [[35.6636 , 139.7634 ], [35.6629 , 139.7664 ]]], bounds
325
+ assert bounds == [[[35.5636 , 138.7634 ], [35.5629 , 138.7664 ]],
326
+ [[35.6636 , 139.7634 ], [35.6629 , 139.7664 ]]], bounds
325
327
326
328
327
329
def test_poly_marker (self ):
0 commit comments