MCPcopy
hub / github.com/python-visualization/folium / test_polyline

Function test_polyline

tests/test_vector_layers.py:286–339  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

284
285
286def test_polyline():
287 m = Map()
288 locations = [[40.0, -80.0], [45.0, -80.0]]
289 polyline = PolyLine(locations=locations, popup="I am PolyLine")
290 polyline.add_to(m)
291
292 expected_options = {
293 "smoothFactor": 1.0,
294 "noClip": False,
295 "bubblingMouseEvents": True,
296 "color": "#3388ff",
297 "dashArray": None,
298 "dashOffset": None,
299 "fill": False,
300 "fillColor": "#3388ff",
301 "fillOpacity": 0.2,
302 "fillRule": "evenodd",
303 "lineCap": "round",
304 "lineJoin": "round",
305 "opacity": 1.0,
306 "stroke": True,
307 "weight": 3,
308 }
309
310 m._repr_html_()
311 expected_rendered = f"""
312 var {polyline.get_name()} = L.polyline(
313 {locations},
314 {{
315 "bubblingMouseEvents": true,
316 "color": "#3388ff",
317 "dashArray": null,
318 "dashOffset": null,
319 "fill": false,
320 "fillColor": "#3388ff",
321 "fillOpacity": 0.2,
322 "fillRule": "evenodd",
323 "lineCap": "round",
324 "lineJoin": "round",
325 "noClip": false,
326 "opacity": 1.0,
327 "smoothFactor": 1.0,
328 "stroke": true,
329 "weight": 3
330 }}
331 )
332 .addTo({m.get_name()});
333 """
334
335 rendered = polyline._template.module.script(polyline)
336 assert normalize(rendered) == normalize(expected_rendered)
337 assert polyline.get_bounds() == get_bounds(locations)
338 assert json.dumps(polyline.to_dict()) == polyline.to_json()
339 assert polyline.options == expected_options
340
341
342def test_mulyipolyline():

Callers

nothing calls this directly

Calls 7

_repr_html_Method · 0.95
MapClass · 0.90
PolyLineClass · 0.90
normalizeFunction · 0.90
get_boundsFunction · 0.90
add_toMethod · 0.80
get_boundsMethod · 0.80

Tested by

no test coverage detected