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

Function test_mulyipolyline

tests/test_vector_layers.py:342–400  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

340
341
342def test_mulyipolyline():
343 m = Map()
344
345 locations = [
346 [[45.51, -122.68], [37.77, -122.43], [34.04, -118.2]],
347 [[40.78, -73.91], [41.83, -87.62], [32.76, -96.72]],
348 ]
349
350 multipolyline = PolyLine(locations=locations, popup="MultiPolyLine")
351 multipolyline.add_to(m)
352
353 expected_options = {
354 "smoothFactor": 1.0,
355 "noClip": False,
356 "bubblingMouseEvents": True,
357 "color": "#3388ff",
358 "dashArray": None,
359 "dashOffset": None,
360 "fill": False,
361 "fillColor": "#3388ff",
362 "fillOpacity": 0.2,
363 "fillRule": "evenodd",
364 "lineCap": "round",
365 "lineJoin": "round",
366 "opacity": 1.0,
367 "stroke": True,
368 "weight": 3,
369 }
370
371 m._repr_html_()
372 expected_rendered = f"""
373 var {multipolyline.get_name()} = L.polyline(
374 {locations},
375 {{
376 "bubblingMouseEvents": true,
377 "color": "#3388ff",
378 "dashArray": null,
379 "dashOffset": null,
380 "fill": false,
381 "fillColor": "#3388ff",
382 "fillOpacity": 0.2,
383 "fillRule": "evenodd",
384 "lineCap": "round",
385 "lineJoin": "round",
386 "noClip": false,
387 "opacity": 1.0,
388 "smoothFactor": 1.0,
389 "stroke": true,
390 "weight": 3
391 }}
392 )
393 .addTo({m.get_name()});
394 """
395
396 rendered = multipolyline._template.module.script(multipolyline)
397 assert normalize(rendered) == normalize(expected_rendered)
398 assert multipolyline.get_bounds() == get_bounds(locations)
399 assert json.dumps(multipolyline.to_dict()) == multipolyline.to_json()

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