Skip to content

Commit d6fc34a

Browse files
committed
Added test for remote JSON.
1 parent 3a8b75f commit d6fc34a

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

tests/test_folium.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
from six import PY3
2222
import branca.element
2323

24+
import requests
25+
2426
import folium
2527
from folium.map import Popup, Marker, FitBounds, FeatureGroup
2628
from folium.features import TopoJson, RectangleMarker, PolygonMarker
@@ -448,3 +450,16 @@ def test_global_switches(self):
448450
assert (mapd.global_switches.prefer_canvas is True and
449451
mapd.global_switches.no_touch is True and
450452
mapd.global_switches.disable_3d is True)
453+
454+
def test_json_request(self):
455+
"""Test requests for remote GeoJSON files."""
456+
self.map = folium.Map(zoom_start=4)
457+
458+
# Adding remote GeoJSON as additional layer.
459+
path = 'https://raw.githubusercontent.com/python-visualization/folium/master/examples/data/us-states.json'
460+
self.map.choropleth(geo_path=path,
461+
smooth_factor=0.5)
462+
463+
self.map._parent.render()
464+
bounds = self.map.get_bounds()
465+
assert bounds == [[18.948267, -178.123152], [71.351633, 173.304726]], bounds

0 commit comments

Comments
 (0)