Skip to content

Commit 940ba0d

Browse files
committed
update tests
1 parent 3e31ffd commit 940ba0d

File tree

3 files changed

+271
-234
lines changed

3 files changed

+271
-234
lines changed

tests/test_circle.py

Lines changed: 0 additions & 146 deletions
This file was deleted.

tests/test_folium.py

Lines changed: 2 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import branca.element
1515

1616
import folium
17-
from folium.features import PolygonMarker, RectangleMarker, TopoJson
17+
from folium.features import Polygon, Rectangle, TopoJson
1818

1919
import jinja2
2020
from jinja2 import Environment, PackageLoader
@@ -201,93 +201,6 @@ def test_feature_group(self):
201201
bounds = m.get_bounds()
202202
assert bounds == [[45, -30], [45, 30]], bounds
203203

204-
def test_rectangle_marker(self):
205-
"""Test rectangle marker additions."""
206-
207-
self.m = folium.Map(location=[45.60, -122.8])
208-
rect_templ = self.env.get_template('rectangle_marker.js')
209-
210-
# Single Rectangle marker.
211-
bounds = [45.60, -122.8, 45.61, -122.7]
212-
self.m.add_child(RectangleMarker(bounds=bounds, popup='Hi'))
213-
marker = list(self.m._children.values())[-1]
214-
rect_1 = rect_templ.render({'RectangleMarker': marker.get_name(),
215-
'location': [45.60, -122.8, 45.61, -122.7],
216-
'color': 'black',
217-
'fill_color': 'black',
218-
'fill_opacity': 0.6,
219-
'weight': 1})
220-
assert (''.join(rect_1.split())[:-1] in
221-
''.join(self.m.get_root().render().split()))
222-
223-
# Second Rectangle marker.
224-
bounds = [45.70, -122.9, 45.75, -122.5]
225-
self.m.add_child(RectangleMarker(bounds=bounds, popup='Hi'))
226-
marker = list(self.m._children.values())[-1]
227-
rect_2 = rect_templ.render({'RectangleMarker': marker.get_name(),
228-
'location': [45.70, -122.9, 45.75, -122.5],
229-
'color': 'black',
230-
'fill_color': 'black',
231-
'fill_opacity': 0.6,
232-
'weight': 1})
233-
assert (''.join(rect_2.split())[:-1] in
234-
''.join(self.m.get_root().render().split()))
235-
236-
bounds = self.m.get_bounds()
237-
assert bounds == [[45.6, -122.9], [45.7, -122.8]], bounds
238-
239-
def test_polygon_marker(self):
240-
"""Test polygon additions."""
241-
242-
self.m = folium.Map(location=[45.60, -122.8])
243-
polygon_templ = self.env.get_template('polygon.js')
244-
245-
# Single PolygonMarker.
246-
locations = [[35.6636, 139.7634],
247-
[35.6629, 139.7664],
248-
[35.6663, 139.7706],
249-
[35.6725, 139.7632],
250-
[35.6728, 139.7627],
251-
[35.6720, 139.7606],
252-
[35.6682, 139.7588],
253-
[35.6663, 139.7627]]
254-
self.m.add_child(PolygonMarker(locations=locations, popup='Hi'))
255-
marker = list(self.m._children.values())[-1]
256-
polygon_1 = polygon_templ.render({'PolygonMarker': marker.get_name(),
257-
'location': locations,
258-
'color': 'black',
259-
'fill_color': 'black',
260-
'fill_opacity': 0.6,
261-
'weight': 1})
262-
assert (''.join(polygon_1.split())[:-1] in
263-
''.join(self.m.get_root().render().split()))
264-
265-
# Second PolygonMarker.
266-
locations = [[35.5636, 138.7634],
267-
[35.5629, 138.7664],
268-
[35.5663, 138.7706],
269-
[35.5725, 138.7632],
270-
[35.5728, 138.7627],
271-
[35.5720, 138.7606],
272-
[35.5682, 138.7588],
273-
[35.5663, 138.7627]]
274-
self.m.add_child(PolygonMarker(locations=locations, color='red',
275-
fill_color='red', fill_opacity=0.7,
276-
weight=3, popup='Hi'))
277-
marker = list(self.m._children.values())[-1]
278-
polygon_2 = polygon_templ.render({'PolygonMarker': marker.get_name(),
279-
'location': locations,
280-
'color': 'red',
281-
'fill_color': 'red',
282-
'fill_opacity': 0.7,
283-
'weight': 3})
284-
assert (''.join(polygon_2.split())[:-1] in
285-
''.join(self.m.get_root().render().split()))
286-
287-
bounds = self.m.get_bounds()
288-
assert bounds == [[[35.5636, 138.7634], [35.5629, 138.7664]],
289-
[[35.6636, 139.7634], [35.6629, 139.7664]]], bounds
290-
291204
def test_topo_json_smooth_factor(self):
292205
"""Test topojson smooth factor method."""
293206
self.m = folium.Map([43, -100], zoom_start=4)
@@ -455,6 +368,7 @@ def test_global_switches(self):
455368
m.global_switches.no_touch is True and
456369
m.global_switches.disable_3d is True)
457370

371+
@pytest.mark.web
458372
def test_json_request(self):
459373
"""Test requests for remote GeoJSON files."""
460374
self.m = folium.Map(zoom_start=4)

0 commit comments

Comments
 (0)