Path: blob/main/tests/plugins/test_semicircle.py
2531 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("""47var {{ this.get_name() }} = L.semiCircle(48{{ this.location|tojson }},49{{ this.options|tojavascript }}50)51.setDirection{{ this.direction }}52.addTo({{ this._parent.get_name() }});53""")5455tmpl_sc2 = Template("""56var {{ this.get_name() }} = L.semiCircle(57{{ this.location|tojson }},58{{ this.options|tojavascript }}59)60.addTo({{ this._parent.get_name() }});61""")62assert normalize(tmpl_sc1.render(this=sc1)) in out63assert normalize(tmpl_sc2.render(this=sc2)) in out6465bounds = m.get_bounds()66assert bounds == [[34, -43], [46, -30]], bounds676869