Nextbus upcoming sort as integer (#61416)
This commit is contained in:
parent
67255d4b52
commit
a6cfbd4072
2 changed files with 3 additions and 2 deletions
|
@ -218,7 +218,7 @@ class NextBusDepartureSensor(SensorEntity):
|
|||
|
||||
# Generate list of upcoming times
|
||||
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)
|
||||
|
|
|
@ -40,6 +40,7 @@ BASIC_RESULTS = {
|
|||
{"minutes": "1", "epochTime": "1553807371000"},
|
||||
{"minutes": "2", "epochTime": "1553807372000"},
|
||||
{"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["stop"] == VALID_STOP_TITLE
|
||||
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(
|
||||
|
|
Loading…
Add table
Reference in a new issue