Skip to content

Commit

Permalink
Fix Marker location validation for numpy array (#1647)
Browse files Browse the repository at this point in the history
  • Loading branch information
Conengmo authored Nov 10, 2022
1 parent 79f4599 commit 35b2ca4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion folium/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def __init__(self, location=None, popup=None, tooltip=None, icon=None,
draggable=False, **kwargs):
super(Marker, self).__init__()
self._name = 'Marker'
self.location = validate_location(location) if location else None
self.location = validate_location(location) if location is not None else None
self.options = parse_options(
draggable=draggable or None,
autoPan=draggable or None,
Expand Down
6 changes: 5 additions & 1 deletion tests/test_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
----------------
"""

import numpy as np
import pytest

from folium import Map
Expand Down Expand Up @@ -148,6 +148,10 @@ def test_marker_valid_location():
m.render()


def test_marker_numpy_array_as_location():
Marker(np.array([0, 0]))


@pytest.mark.filterwarnings('ignore::UserWarning')
def test_icon_invalid_marker_colors():
pytest.warns(UserWarning, Icon, color='lila')
Expand Down

0 comments on commit 35b2ca4

Please sign in to comment.