Skip to content

Commit c942b86

Browse files
author
Justin Poehnelt
authored
fix: static map label (#374)
1 parent adf9cde commit c942b86

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

googlemaps/maps.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ def __init__(self, locations,
7575
self.params.append("color:%s" % color)
7676

7777
if label:
78-
if len(label) != 1 or not label.isupper() or not label.isalnum():
79-
raise ValueError("Invalid label")
78+
if len(label) != 1 or (label.isalpha() and not label.isupper()) or not label.isalnum():
79+
raise ValueError("Marker label must be alphanumeric and uppercase.")
8080
self.params.append("label:%s" % label)
8181

8282
self.params.append(convert.location_list(locations))

tests/test_maps.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ def test_static_map_marker(self):
4949
with self.assertRaises(ValueError):
5050
StaticMapMarker(locations=["Sydney"], label="XS")
5151

52+
self.assertEqual("label:1|Sydney", str(StaticMapMarker(locations=["Sydney"], label="1")))
53+
5254
@responses.activate
5355
def test_static_map_path(self):
5456
path = StaticMapPath(

0 commit comments

Comments
 (0)