Skip to content

Commit faffad4

Browse files
committed
Merge pull request #254 from ocefpaf/popup_tests
Popup tests
2 parents 9c4dcb2 + 6cc370b commit faffad4

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

folium/map.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
66
Classes for drawing maps.
77
"""
8+
9+
from __future__ import unicode_literals
10+
811
import warnings
912
import json
1013
from collections import OrderedDict

tests/test_map.py

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

0 commit comments

Comments
 (0)