Fix key error in config flow when duplicate stop names exist (#101491)

This commit is contained in:
Ian 2023-10-05 16:11:15 -04:00 committed by GitHub
parent ce55116eb2
commit fe316f2233
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -58,7 +58,7 @@ def _get_stop_tags(
# Append directions for stops with shared titles
for tag, title in tags.items():
if title_counts[title] > 1:
tags[tag] = f"{title} ({stop_directions[tag]})"
tags[tag] = f"{title} ({stop_directions.get(tag, tag)})"
return tags

View File

@ -19,6 +19,8 @@ def mock_nextbus_lists(mock_nextbus: MagicMock) -> MagicMock:
"stop": [
{"tag": "5650", "title": "Market St & 7th St"},
{"tag": "5651", "title": "Market St & 7th St"},
# Error case test. Duplicate title with no unique direction
{"tag": "5652", "title": "Market St & 7th St"},
],
"direction": [
{