mirror of
https://github.com/esphome/esphome.git
synced 2025-10-30 14:43:51 +00:00
[ruff] Enable SIM rules and fix code simplification violations (#9872)
This commit is contained in:
@@ -70,11 +70,13 @@ async def test_scheduler_defer_cancel(
|
||||
test_complete_future.set_result(True)
|
||||
return
|
||||
|
||||
if state.key == test_result_entity.key and not test_result_future.done():
|
||||
# Event type should be "defer_executed_X" where X is the defer number
|
||||
if state.event_type.startswith("defer_executed_"):
|
||||
defer_num = int(state.event_type.split("_")[-1])
|
||||
test_result_future.set_result(defer_num)
|
||||
if (
|
||||
state.key == test_result_entity.key
|
||||
and not test_result_future.done()
|
||||
and state.event_type.startswith("defer_executed_")
|
||||
):
|
||||
defer_num = int(state.event_type.split("_")[-1])
|
||||
test_result_future.set_result(defer_num)
|
||||
|
||||
client.subscribe_states(on_state)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user