mirror of
https://github.com/home-assistant/core.git
synced 2025-04-26 02:07:54 +00:00
parent
68450734f1
commit
52cf6c7baf
@ -53,28 +53,28 @@ async def test_async_match_states(hass):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Match on name
|
# Match on name
|
||||||
assert [state1] == list(
|
assert list(
|
||||||
intent.async_match_states(hass, name="kitchen light", states=[state1, state2])
|
intent.async_match_states(hass, name="kitchen light", states=[state1, state2])
|
||||||
)
|
) == [state1]
|
||||||
|
|
||||||
# Test alias
|
# Test alias
|
||||||
assert [state2] == list(
|
assert list(
|
||||||
intent.async_match_states(hass, name="kill switch", states=[state1, state2])
|
intent.async_match_states(hass, name="kill switch", states=[state1, state2])
|
||||||
)
|
) == [state2]
|
||||||
|
|
||||||
# Name + area
|
# Name + area
|
||||||
assert [state1] == list(
|
assert list(
|
||||||
intent.async_match_states(
|
intent.async_match_states(
|
||||||
hass, name="kitchen light", area_name="kitchen", states=[state1, state2]
|
hass, name="kitchen light", area_name="kitchen", states=[state1, state2]
|
||||||
)
|
)
|
||||||
)
|
) == [state1]
|
||||||
|
|
||||||
# Test area alias
|
# Test area alias
|
||||||
assert [state1] == list(
|
assert list(
|
||||||
intent.async_match_states(
|
intent.async_match_states(
|
||||||
hass, name="kitchen light", area_name="food room", states=[state1, state2]
|
hass, name="kitchen light", area_name="food room", states=[state1, state2]
|
||||||
)
|
)
|
||||||
)
|
) == [state1]
|
||||||
|
|
||||||
# Wrong area
|
# Wrong area
|
||||||
assert not list(
|
assert not list(
|
||||||
@ -84,21 +84,21 @@ async def test_async_match_states(hass):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Domain + area
|
# Domain + area
|
||||||
assert [state2] == list(
|
assert list(
|
||||||
intent.async_match_states(
|
intent.async_match_states(
|
||||||
hass, domains={"switch"}, area_name="bedroom", states=[state1, state2]
|
hass, domains={"switch"}, area_name="bedroom", states=[state1, state2]
|
||||||
)
|
)
|
||||||
)
|
) == [state2]
|
||||||
|
|
||||||
# Device class + area
|
# Device class + area
|
||||||
assert [state2] == list(
|
assert list(
|
||||||
intent.async_match_states(
|
intent.async_match_states(
|
||||||
hass,
|
hass,
|
||||||
device_classes={SwitchDeviceClass.OUTLET},
|
device_classes={SwitchDeviceClass.OUTLET},
|
||||||
area_name="bedroom",
|
area_name="bedroom",
|
||||||
states=[state1, state2],
|
states=[state1, state2],
|
||||||
)
|
)
|
||||||
)
|
) == [state2]
|
||||||
|
|
||||||
|
|
||||||
async def test_match_device_area(hass):
|
async def test_match_device_area(hass):
|
||||||
@ -130,14 +130,14 @@ async def test_match_device_area(hass):
|
|||||||
entities.async_update_entity(state2.entity_id, area_id=area_bedroom.id)
|
entities.async_update_entity(state2.entity_id, area_id=area_bedroom.id)
|
||||||
|
|
||||||
# Match on area/domain
|
# Match on area/domain
|
||||||
assert [state1] == list(
|
assert list(
|
||||||
intent.async_match_states(
|
intent.async_match_states(
|
||||||
hass,
|
hass,
|
||||||
domains={"light"},
|
domains={"light"},
|
||||||
area_name="kitchen",
|
area_name="kitchen",
|
||||||
states=[state1, state2, state3],
|
states=[state1, state2, state3],
|
||||||
)
|
)
|
||||||
)
|
) == [state1]
|
||||||
|
|
||||||
|
|
||||||
def test_async_validate_slots():
|
def test_async_validate_slots():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user