MCPcopy Index your code
hub / github.com/python-visualization/folium / test_float_image

Function test_float_image

tests/plugins/test_float_image.py:12–48  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10
11
12def test_float_image():
13 m = folium.Map([45.0, 3.0], zoom_start=4)
14 url = "https://raw.githubusercontent.com/SECOORA/static_assets/master/maps/img/rose.png"
15 szt = plugins.FloatImage(url, bottom=60, left=70, width="20%")
16 m.add_child(szt)
17 m._repr_html_()
18
19 out = normalize(m._parent.render())
20
21 # Verify that the div has been created.
22 tmpl = Template(
23 """
24 <img id="{{this.get_name()}}" alt="float_image"
25 src="https://raw.githubusercontent.com/SECOORA/static_assets/master/maps/img/rose.png"
26 style="z-index: 999999">
27 </img>
28 """
29 )
30 assert normalize(tmpl.render(this=szt)) in out
31
32 # Verify that the style has been created.
33 tmpl = Template(
34 """
35 <style>
36 #{{this.get_name()}} {
37 position: absolute;
38 bottom: 60%;
39 left: 70%;
40 width: 20%;
41 }
42 </style>
43 """
44 )
45 assert normalize(tmpl.render(this=szt)) in out
46
47 bounds = m.get_bounds()
48 assert bounds == [[None, None], [None, None]], bounds

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