From d85aad4d5cfba854c7a69883c505573793e102a8 Mon Sep 17 00:00:00 2001 From: Justin Poehnelt Date: Tue, 28 Jul 2020 10:25:09 -0700 Subject: [PATCH 1/2] test: add failing test --- tests/test_maps.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_maps.py b/tests/test_maps.py index db83ee04..3748e60c 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("", StaticMapMarker(locations=["Sydney"], label="1")) + @responses.activate def test_static_map_path(self): path = StaticMapPath( From aab2fb8148a96a190dfd81becc0adecb2fb06729 Mon Sep 17 00:00:00 2001 From: Justin Poehnelt Date: Tue, 28 Jul 2020 10:41:56 -0700 Subject: [PATCH 2/2] fix: static maps marker label --- googlemaps/maps.py | 4 ++-- tests/test_maps.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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 3748e60c..8db6298f 100644 --- a/tests/test_maps.py +++ b/tests/test_maps.py @@ -49,7 +49,7 @@ def test_static_map_marker(self): with self.assertRaises(ValueError): StaticMapMarker(locations=["Sydney"], label="XS") - self.assertEqual("", StaticMapMarker(locations=["Sydney"], label="1")) + self.assertEqual("label:1|Sydney", str(StaticMapMarker(locations=["Sydney"], label="1"))) @responses.activate def test_static_map_path(self):