Skip to content

Commit

Permalink
Apply recent fixes to master.
Browse files Browse the repository at this point in the history
  • Loading branch information
abdullahselek committed Apr 6, 2024
1 parent a0eddfe commit 4d56eeb
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
4 changes: 2 additions & 2 deletions herepy/routing_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ def route_v8(
via_keys = []
if via:
for i, v in enumerate(via):
key = str.format("{0}{1}", "via", i)
key = str.format("{0}{1}_", "via", i)
via_keys.append(key)
data[key] = str.format("{0},{1}", v[0], v[1])
if departure_time:
Expand Down Expand Up @@ -845,7 +845,7 @@ def _get_coordinates_for_location_name(self, location_name: str) -> List[float]:
geocoder_response = geocoder_api.free_form(location_name)
coordinates = geocoder_response.items[0]["position"]
return [coordinates["lat"], coordinates["lng"]]
except (HEREError) as here_error:
except HEREError as here_error:
raise WaypointNotFoundError(here_error.message)

@staticmethod
Expand Down
22 changes: 22 additions & 0 deletions tests/test_routing_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1179,3 +1179,25 @@ def test_route_v8_error_access_denied(self):
truck={"shippedHazardousGoods": ["explosive", "gas"]},
scooter={"allowHighway": "true"},
)

@responses.activate
def test_route_v8_multiple_via_points(self):
responses.add(
responses.GET,
"https://router.hereapi.com/v8/routes",
"{}",
status=200,
match=[
responses.matchers.query_param_matcher(
{"via": ["41.9339,-87.9021"] * 11}, strict_match=False
)
],
)
response = self._api.route_v8(
transport_mode=herepy.RoutingTransportMode.car,
origin=[41.9798, -87.8801],
destination=[41.9043, -87.9216],
via=[[41.9339, -87.9021]] * 11,
)
self.assertTrue(response)
self.assertIsInstance(response, herepy.RoutingResponseV8)

0 comments on commit 4d56eeb

Please sign in to comment.