diff --git a/tests/helpers/test_intent.py b/tests/helpers/test_intent.py index 9f62e76ebc0..c592fc50c0a 100644 --- a/tests/helpers/test_intent.py +++ b/tests/helpers/test_intent.py @@ -708,6 +708,9 @@ async def test_invalid_area_floor_names(hass: HomeAssistant) -> None: ) intent.async_register(hass, handler) + # Need a light to avoid domain error + hass.states.async_set("light.test", "off") + with pytest.raises(intent.MatchFailedError) as err: await intent.async_handle( hass, @@ -715,7 +718,7 @@ async def test_invalid_area_floor_names(hass: HomeAssistant) -> None: "TestType", slots={"area": {"value": "invalid area"}}, ) - assert err.value.result.no_match_reason == intent.MatchFailedReason.INVALID_AREA + assert err.value.result.no_match_reason == intent.MatchFailedReason.INVALID_AREA with pytest.raises(intent.MatchFailedError) as err: await intent.async_handle( @@ -724,9 +727,7 @@ async def test_invalid_area_floor_names(hass: HomeAssistant) -> None: "TestType", slots={"floor": {"value": "invalid floor"}}, ) - assert ( - err.value.result.no_match_reason == intent.MatchFailedReason.INVALID_FLOOR - ) + assert err.value.result.no_match_reason == intent.MatchFailedReason.INVALID_FLOOR async def test_service_intent_handler_required_domains(hass: HomeAssistant) -> None: