Fix recognition of entity names in default agent with interpunction (#151759)

This commit is contained in:
Artur Pragacz
2025-09-05 10:30:27 +00:00
committed by Franck Nijhof
parent 7dbeaa475d
commit 625f586945
2 changed files with 27 additions and 6 deletions
@@ -231,6 +231,29 @@ async def test_conversation_agent(hass: HomeAssistant) -> None:
)
@pytest.mark.usefixtures("init_components")
async def test_punctuation(hass: HomeAssistant) -> None:
"""Test punctuation is handled properly."""
hass.states.async_set(
"light.test_light",
"off",
attributes={ATTR_FRIENDLY_NAME: "Test light"},
)
expose_entity(hass, "light.test_light", True)
calls = async_mock_service(hass, "light", "turn_on")
result = await conversation.async_converse(
hass, "Turn?? on,, test;; light!!!", None, Context(), None
)
assert len(calls) == 1
assert calls[0].data["entity_id"][0] == "light.test_light"
assert result.response.response_type == intent.IntentResponseType.ACTION_DONE
assert result.response.intent is not None
assert result.response.intent.slots["name"]["value"] == "test light"
assert result.response.intent.slots["name"]["text"] == "test light"
async def test_expose_flag_automatically_set(
hass: HomeAssistant,
entity_registry: er.EntityRegistry,