Skip to content

Commit 5368adc

Browse files
committed
Popup tests.
1 parent 9c4dcb2 commit 5368adc

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

tests/test_map.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# -*- coding: utf-8 -*-
2+
3+
"""
4+
Folium map Tests
5+
----------------
6+
7+
"""
8+
from folium.map import Popup # TODO: Map, Marker, ...
9+
10+
11+
tmpl = """
12+
<div id="{id}"
13+
style="width: {width}; height: {height};">
14+
{text}</div>
15+
""".format
16+
17+
18+
def test_popup_ascii():
19+
popup = Popup('Some text.')
20+
_id = list(popup.html._children.items())[0][0]
21+
kw = dict(id=_id,
22+
width='100.0%',
23+
height='100.0%',
24+
text='Some text.')
25+
assert popup.html.render().strip() == tmpl(**kw).strip()
26+
27+
28+
def test_popup_quotes():
29+
popup = Popup("Let's try quotes")
30+
_id = list(popup.html._children.items())[0][0]
31+
kw = dict(id=_id,
32+
width='100.0%',
33+
height='100.0%',
34+
text='Let&#39;s try quotes')
35+
assert popup.html.render().strip() == tmpl(**kw).strip()
36+
37+
38+
def test_popup_unicode():
39+
popup = Popup("Ça c'est chouette")
40+
_id = list(popup.html._children.items())[0][0]
41+
kw = dict(id=_id,
42+
width='100.0%',
43+
height='100.0%',
44+
text="&#199;a c'est chouette")
45+
assert popup.html.render().strip() == tmpl(**kw).strip()

0 commit comments

Comments
 (0)