Path: blob/main/tests/plugins/test_semicircle.py
1601 views
"""1Test SemiCircle2---------------34"""56import folium7from folium import plugins8from folium.template import Template9from folium.utilities import normalize101112def test_semicircle():13m = folium.Map([30.0, 0.0], zoom_start=3)14sc1 = plugins.SemiCircle(15(34, -43),16radius=400000,17arc=300,18direction=20,19color="red",20fill_color="red",21opacity=0,22popup="Direction - 20 degrees, arc 300 degrees",23)24sc2 = plugins.SemiCircle(25(46, -30),26radius=400000,27start_angle=10,28stop_angle=50,29color="red",30fill_color="red",31opacity=0,32popup="Start angle - 10 degrees, Stop angle - 50 degrees",33)3435m.add_child(sc1)36m.add_child(sc2)37m._repr_html_()3839out = normalize(m._parent.render())4041# We verify that the script import is present.42script = '<script src="https://cdn.jsdelivr.net/npm/[email protected]/Semicircle.min.js"></script>' # noqa43assert script in out4445# We verify that the script part is correct.46tmpl_sc1 = Template(47"""48var {{ this.get_name() }} = L.semiCircle(49{{ this.location|tojson }},50{{ this.options|tojavascript }}51)52.setDirection{{ this.direction }}53.addTo({{ this._parent.get_name() }});54"""55)5657tmpl_sc2 = Template(58"""59var {{ this.get_name() }} = L.semiCircle(60{{ this.location|tojson }},61{{ this.options|tojavascript }}62)63.addTo({{ this._parent.get_name() }});64"""65)66assert normalize(tmpl_sc1.render(this=sc1)) in out67assert normalize(tmpl_sc2.render(this=sc2)) in out6869bounds = m.get_bounds()70assert bounds == [[34, -43], [46, -30]], bounds717273