mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Nextbus upcoming sort as integer (#61416)
This commit is contained in:
parent
67255d4b52
commit
a6cfbd4072
@ -218,7 +218,7 @@ class NextBusDepartureSensor(SensorEntity):
|
|||||||
|
|
||||||
# Generate list of upcoming times
|
# Generate list of upcoming times
|
||||||
self._attributes["upcoming"] = ", ".join(
|
self._attributes["upcoming"] = ", ".join(
|
||||||
sorted(p["minutes"] for p in predictions)
|
sorted((p["minutes"] for p in predictions), key=int)
|
||||||
)
|
)
|
||||||
|
|
||||||
latest_prediction = maybe_first(predictions)
|
latest_prediction = maybe_first(predictions)
|
||||||
|
@ -40,6 +40,7 @@ BASIC_RESULTS = {
|
|||||||
{"minutes": "1", "epochTime": "1553807371000"},
|
{"minutes": "1", "epochTime": "1553807371000"},
|
||||||
{"minutes": "2", "epochTime": "1553807372000"},
|
{"minutes": "2", "epochTime": "1553807372000"},
|
||||||
{"minutes": "3", "epochTime": "1553807373000"},
|
{"minutes": "3", "epochTime": "1553807373000"},
|
||||||
|
{"minutes": "10", "epochTime": "1553807380000"},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -128,7 +129,7 @@ async def test_verify_valid_state(
|
|||||||
assert state.attributes["route"] == VALID_ROUTE_TITLE
|
assert state.attributes["route"] == VALID_ROUTE_TITLE
|
||||||
assert state.attributes["stop"] == VALID_STOP_TITLE
|
assert state.attributes["stop"] == VALID_STOP_TITLE
|
||||||
assert state.attributes["direction"] == "Outbound"
|
assert state.attributes["direction"] == "Outbound"
|
||||||
assert state.attributes["upcoming"] == "1, 2, 3"
|
assert state.attributes["upcoming"] == "1, 2, 3, 10"
|
||||||
|
|
||||||
|
|
||||||
async def test_message_dict(
|
async def test_message_dict(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user