mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 14:27:07 +00:00
Fix key error in config flow when duplicate stop names exist (#101491)
This commit is contained in:
parent
ce55116eb2
commit
fe316f2233
@ -58,7 +58,7 @@ def _get_stop_tags(
|
|||||||
# Append directions for stops with shared titles
|
# Append directions for stops with shared titles
|
||||||
for tag, title in tags.items():
|
for tag, title in tags.items():
|
||||||
if title_counts[title] > 1:
|
if title_counts[title] > 1:
|
||||||
tags[tag] = f"{title} ({stop_directions[tag]})"
|
tags[tag] = f"{title} ({stop_directions.get(tag, tag)})"
|
||||||
|
|
||||||
return tags
|
return tags
|
||||||
|
|
||||||
|
@ -19,6 +19,8 @@ def mock_nextbus_lists(mock_nextbus: MagicMock) -> MagicMock:
|
|||||||
"stop": [
|
"stop": [
|
||||||
{"tag": "5650", "title": "Market St & 7th St"},
|
{"tag": "5650", "title": "Market St & 7th St"},
|
||||||
{"tag": "5651", "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": [
|
"direction": [
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user