Skip to content

Fix Marker location validation for numpy array #1647

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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