1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Simplify access to hass in service calls (#133062)

This commit is contained in:
epenet
2024-12-13 09:31:21 +01:00
committed by GitHub
parent f9f37b9932
commit 899fb091fc
7 changed files with 204 additions and 94 deletions

View File

@@ -1562,10 +1562,10 @@ async def test_statemachine_avoids_updating_attributes(hass: HomeAssistant) -> N
def test_service_call_repr() -> None:
"""Test ServiceCall repr."""
call = ha.ServiceCall("homeassistant", "start")
call = ha.ServiceCall(None, "homeassistant", "start")
assert str(call) == f"<ServiceCall homeassistant.start (c:{call.context.id})>"
call2 = ha.ServiceCall("homeassistant", "start", {"fast": "yes"})
call2 = ha.ServiceCall(None, "homeassistant", "start", {"fast": "yes"})
assert (
str(call2)
== f"<ServiceCall homeassistant.start (c:{call2.context.id}): fast=yes>"