MCPcopy Create free account
hub / github.com/python-visualization/folium / test_boat_marker

Function test_boat_marker

tests/plugins/test_boat_marker.py:13–51  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11
12
13def test_boat_marker():
14 m = folium.Map([30.0, 0.0], zoom_start=3)
15 bm1 = plugins.BoatMarker(
16 (34, -43), heading=45, wind_heading=150, wind_speed=45, color="#8f8"
17 )
18 bm2 = plugins.BoatMarker(
19 (46, -30), heading=-20, wind_heading=46, wind_speed=25, color="#88f"
20 )
21
22 m.add_child(bm1)
23 m.add_child(bm2)
24 m._repr_html_()
25
26 out = normalize(m._parent.render())
27
28 # We verify that the script import is present.
29 script = '<script src="https://unpkg.com/leaflet.boatmarker/leaflet.boatmarker.min.js"></script>' # noqa
30 assert script in out
31
32 # We verify that the script part is correct.
33 tmpl = Template(
34 """
35 var {{ this.get_name() }} = L.boatMarker(
36 {{ this.location|tojson }},
37 {{ this.options|tojavascript }}
38 ).addTo({{ this._parent.get_name() }});
39 {{ this.get_name() }}.setHeadingWind(
40 {{ this.heading }},
41 {{ this.wind_speed }},
42 {{ this.wind_heading }}
43 );
44 """
45 )
46
47 assert normalize(tmpl.render(this=bm1)) in out
48 assert normalize(tmpl.render(this=bm2)) in out
49
50 bounds = m.get_bounds()
51 assert bounds == [[34, -43], [46, -30]], bounds
52
53
54def test_boat_marker_with_no_wind_speed_or_heading():

Callers

nothing calls this directly

Calls 6

_repr_html_Method · 0.95
normalizeFunction · 0.90
TemplateClass · 0.90
get_boundsMethod · 0.80
add_childMethod · 0.45
renderMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…