Skip to content

Commit 35b2ca4

Browse files
authored
Fix Marker location validation for numpy array (#1647)
1 parent 79f4599 commit 35b2ca4

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

folium/map.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ def __init__(self, location=None, popup=None, tooltip=None, icon=None,
275275
draggable=False, **kwargs):
276276
super(Marker, self).__init__()
277277
self._name = 'Marker'
278-
self.location = validate_location(location) if location else None
278+
self.location = validate_location(location) if location is not None else None
279279
self.options = parse_options(
280280
draggable=draggable or None,
281281
autoPan=draggable or None,

tests/test_map.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
----------------
44
55
"""
6-
6+
import numpy as np
77
import pytest
88

99
from folium import Map
@@ -148,6 +148,10 @@ def test_marker_valid_location():
148148
m.render()
149149

150150

151+
def test_marker_numpy_array_as_location():
152+
Marker(np.array([0, 0]))
153+
154+
151155
@pytest.mark.filterwarnings('ignore::UserWarning')
152156
def test_icon_invalid_marker_colors():
153157
pytest.warns(UserWarning, Icon, color='lila')

0 commit comments

Comments
 (0)