Skip to content

Commit 0bb71dc

Browse files
committed
Added test for Control typechecking
1 parent 4a1e419 commit 0bb71dc

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/test_folium.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,3 +501,29 @@ def test_json_request(self):
501501
np.testing.assert_allclose(
502502
bounds, [[18.948267, -178.123152], [71.351633, 173.304726]]
503503
)
504+
505+
def test_control_typecheck(self):
506+
m = folium.Map(
507+
location=[39.949610, -75.150282], zoom_start=5, zoom_control=False
508+
)
509+
tiles = TileLayer(
510+
tiles="OpenStreetMap",
511+
show=False,
512+
control=False,
513+
)
514+
tiles.add_to(m)
515+
516+
with pytest.raises(TypeError) as excinfo:
517+
minimap = folium.Control("MiniMap", tiles, position="downunder")
518+
minimap.add_js_link(
519+
"minimap_js",
520+
"https://cdnjs.cloudflare.com/ajax/libs/leaflet-minimap/3.6.1/Control.MiniMap.min.js",
521+
)
522+
minimap.add_css_link(
523+
"minimap_css",
524+
"https://cdnjs.cloudflare.com/ajax/libs/leaflet-minimap/3.6.1/Control.MiniMap.css",
525+
)
526+
minimap.add_to(m)
527+
assert "position must be one of ('bottomright', 'bottomleft'" in str(
528+
excinfo.value
529+
)

0 commit comments

Comments
 (0)