Skip to content

Commit b7fffca

Browse files
committed
Fix warnings.
1 parent 0dd7697 commit b7fffca

File tree

2 files changed

+41
-39
lines changed

2 files changed

+41
-39
lines changed

folium/folium.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
from .map import LegacyMap, Icon, Marker, Popup, FitBounds
2020
from .features import (WmsTileLayer, RegularPolygonMarker, Vega, GeoJson,
21-
CircleMarker, RectangleMarker, Polygon, LatLngPopup,
21+
CircleMarker, LatLngPopup,
2222
ClickForMarker, TopoJson, PolyLine, MultiPolyLine,
2323
)
2424

tests/test_folium.py

Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -238,56 +238,56 @@ def test_circle_marker(self):
238238
bounds = self.map.get_bounds()
239239
assert bounds == [[45.6, -122.9], [45.7, -122.8]], bounds
240240

241-
242241
def test_rectangle_marker(self):
243242
"""Test rectangle marker additions."""
244243

245244
self.map = folium.Map(location=[45.60, -122.8])
246245
rect_templ = self.env.get_template('rectangle_marker.js')
247246

248247
# 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'))
250250
marker = list(self.map._children.values())[-1]
251251
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})
257257
assert (''.join(rect_1.split())[:-1] in
258258
''.join(self.map.get_root().render().split()))
259259

260260
# 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'))
262263
marker = list(self.map._children.values())[-1]
263264
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})
269270
assert (''.join(rect_2.split())[:-1] in
270271
''.join(self.map.get_root().render().split()))
271272

272273
bounds = self.map.get_bounds()
273274
assert bounds == [[45.6, -122.9], [45.7, -122.8]], bounds
274275

275-
276276
def test_polygon(self):
277277
"""Test polygon additions."""
278278

279279
self.map = folium.Map(location=[45.60, -122.8])
280280
polygon_templ = self.env.get_template('polygon.js')
281281

282282
# 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]]
291291
self.map.add_child(folium.Polygon(locations=locations, popup='Hi'))
292292
marker = list(self.map._children.values())[-1]
293293
polygon_1 = polygon_templ.render({'Polygon': marker.get_name(),
@@ -300,28 +300,30 @@ def test_polygon(self):
300300
''.join(self.map.get_root().render().split()))
301301

302302
# 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'))
313314
marker = list(self.map._children.values())[-1]
314315
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})
320321
assert (''.join(polygon_2.split())[:-1] in
321322
''.join(self.map.get_root().render().split()))
322323

323324
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
325327

326328

327329
def test_poly_marker(self):

0 commit comments

Comments
 (0)