Update import locations in tests (#122216)

This commit is contained in:
Marc Mueller
2024-07-20 11:16:04 +02:00
committed by GitHub
parent 0637e342f6
commit a6068dcdf2
46 changed files with 131 additions and 125 deletions

View File

@@ -1629,7 +1629,7 @@ async def test_serviceregistry_call_non_existing_with_blocking(
hass: HomeAssistant,
) -> None:
"""Test non-existing with blocking."""
with pytest.raises(ha.ServiceNotFound):
with pytest.raises(ServiceNotFound):
await hass.services.async_call("test_domain", "i_do_not_exist", blocking=True)
@@ -2529,14 +2529,14 @@ async def test_reserving_states(hass: HomeAssistant) -> None:
hass.states.async_set("light.bedroom", "on")
assert hass.states.async_available("light.bedroom") is False
with pytest.raises(ha.HomeAssistantError):
with pytest.raises(HomeAssistantError):
hass.states.async_reserve("light.bedroom")
hass.states.async_remove("light.bedroom")
assert hass.states.async_available("light.bedroom") is True
hass.states.async_set("light.bedroom", "on")
with pytest.raises(ha.HomeAssistantError):
with pytest.raises(HomeAssistantError):
hass.states.async_reserve("light.bedroom")
assert hass.states.async_available("light.bedroom") is False
@@ -2840,7 +2840,7 @@ async def test_state_change_events_context_id_match_state_time(
hass: HomeAssistant,
) -> None:
"""Test last_updated, timed_fired, and the ulid all have the same time."""
events = async_capture_events(hass, ha.EVENT_STATE_CHANGED)
events = async_capture_events(hass, EVENT_STATE_CHANGED)
hass.states.async_set("light.bedroom", "on")
await hass.async_block_till_done()
state: State = hass.states.get("light.bedroom")
@@ -2859,7 +2859,7 @@ async def test_state_change_events_match_time_with_limits_of_precision(
a bit better than the precision of datetime.now() which is used for last_updated
on some platforms.
"""
events = async_capture_events(hass, ha.EVENT_STATE_CHANGED)
events = async_capture_events(hass, EVENT_STATE_CHANGED)
hass.states.async_set("light.bedroom", "on")
await hass.async_block_till_done()
state: State = hass.states.get("light.bedroom")