diff --git a/googlemaps/maps.py b/googlemaps/maps.py index eedcc422..763e0126 100644 --- a/googlemaps/maps.py +++ b/googlemaps/maps.py @@ -75,8 +75,8 @@ def __init__(self, locations, self.params.append("color:%s" % color) if label: - if len(label) != 1 or not label.isupper() or not label.isalnum(): - raise ValueError("Invalid label") + if len(label) != 1 or (label.isalpha() and not label.isupper()) or not label.isalnum(): + raise ValueError("Marker label must be alphanumeric and uppercase.") self.params.append("label:%s" % label) self.params.append(convert.location_list(locations)) diff --git a/tests/test_maps.py b/tests/test_maps.py index db83ee04..8db6298f 100644 --- a/tests/test_maps.py +++ b/tests/test_maps.py @@ -49,6 +49,8 @@ def test_static_map_marker(self): with self.assertRaises(ValueError): StaticMapMarker(locations=["Sydney"], label="XS") + self.assertEqual("label:1|Sydney", str(StaticMapMarker(locations=["Sydney"], label="1"))) + @responses.activate def test_static_map_path(self): path = StaticMapPath(