Refactor recorder states tests (#114073)
https://github.com/home-assistant/core/pull/113985#discussion_r1536596573
This commit is contained in:
parent
4f18f0d902
commit
82016ff528
4 changed files with 36 additions and 32 deletions
|
@ -36,12 +36,13 @@ async def test_exclude_attributes(recorder_mock: Recorder, hass: HomeAssistant)
|
||||||
get_significant_states, hass, now, None, hass.states.async_entity_ids()
|
get_significant_states, hass, now, None, hass.states.async_entity_ids()
|
||||||
)
|
)
|
||||||
assert len(states) >= 1
|
assert len(states) >= 1
|
||||||
for entity_states in states.values():
|
for state in (
|
||||||
for state in filter(
|
state
|
||||||
lambda state: split_entity_id(state.entity_id)[0] == humidifier.DOMAIN,
|
for entity_states in states.values()
|
||||||
entity_states,
|
for state in entity_states
|
||||||
):
|
if split_entity_id(state.entity_id)[0] == humidifier.DOMAIN
|
||||||
assert ATTR_MIN_HUMIDITY not in state.attributes
|
):
|
||||||
assert ATTR_MAX_HUMIDITY not in state.attributes
|
assert ATTR_MIN_HUMIDITY not in state.attributes
|
||||||
assert ATTR_AVAILABLE_MODES not in state.attributes
|
assert ATTR_MAX_HUMIDITY not in state.attributes
|
||||||
assert ATTR_FRIENDLY_NAME in state.attributes
|
assert ATTR_AVAILABLE_MODES not in state.attributes
|
||||||
|
assert ATTR_FRIENDLY_NAME in state.attributes
|
||||||
|
|
|
@ -32,10 +32,11 @@ async def test_exclude_attributes(recorder_mock: Recorder, hass: HomeAssistant)
|
||||||
get_significant_states, hass, now, None, hass.states.async_entity_ids()
|
get_significant_states, hass, now, None, hass.states.async_entity_ids()
|
||||||
)
|
)
|
||||||
assert len(states) >= 1
|
assert len(states) >= 1
|
||||||
for entity_states in states.values():
|
for state in (
|
||||||
for state in filter(
|
state
|
||||||
lambda state: split_entity_id(state.entity_id)[0] == siren.DOMAIN,
|
for entity_states in states.values()
|
||||||
entity_states,
|
for state in entity_states
|
||||||
):
|
if split_entity_id(state.entity_id)[0] == siren.DOMAIN
|
||||||
assert ATTR_AVAILABLE_TONES not in state.attributes
|
):
|
||||||
assert ATTR_FRIENDLY_NAME in state.attributes
|
assert ATTR_AVAILABLE_TONES not in state.attributes
|
||||||
|
assert ATTR_FRIENDLY_NAME in state.attributes
|
||||||
|
|
|
@ -32,10 +32,11 @@ async def test_exclude_attributes(recorder_mock: Recorder, hass: HomeAssistant)
|
||||||
get_significant_states, hass, now, None, hass.states.async_entity_ids()
|
get_significant_states, hass, now, None, hass.states.async_entity_ids()
|
||||||
)
|
)
|
||||||
assert len(states) >= 1
|
assert len(states) >= 1
|
||||||
for entity_states in states.values():
|
for state in (
|
||||||
for state in filter(
|
state
|
||||||
lambda state: split_entity_id(state.entity_id)[0] == vacuum.DOMAIN,
|
for entity_states in states.values()
|
||||||
entity_states,
|
for state in entity_states
|
||||||
):
|
if split_entity_id(state.entity_id)[0] == vacuum.DOMAIN
|
||||||
assert ATTR_FAN_SPEED_LIST not in state.attributes
|
):
|
||||||
assert ATTR_FRIENDLY_NAME in state.attributes
|
assert ATTR_FAN_SPEED_LIST not in state.attributes
|
||||||
|
assert ATTR_FRIENDLY_NAME in state.attributes
|
||||||
|
|
|
@ -36,12 +36,13 @@ async def test_exclude_attributes(recorder_mock: Recorder, hass: HomeAssistant)
|
||||||
get_significant_states, hass, now, None, hass.states.async_entity_ids()
|
get_significant_states, hass, now, None, hass.states.async_entity_ids()
|
||||||
)
|
)
|
||||||
assert len(states) >= 1
|
assert len(states) >= 1
|
||||||
for entity_states in states.values():
|
for state in (
|
||||||
for state in filter(
|
state
|
||||||
lambda state: split_entity_id(state.entity_id)[0] == water_heater.DOMAIN,
|
for entity_states in states.values()
|
||||||
entity_states,
|
for state in entity_states
|
||||||
):
|
if split_entity_id(state.entity_id)[0] == water_heater.DOMAIN
|
||||||
assert ATTR_OPERATION_LIST not in state.attributes
|
):
|
||||||
assert ATTR_MIN_TEMP not in state.attributes
|
assert ATTR_OPERATION_LIST not in state.attributes
|
||||||
assert ATTR_MAX_TEMP not in state.attributes
|
assert ATTR_MIN_TEMP not in state.attributes
|
||||||
assert ATTR_FRIENDLY_NAME in state.attributes
|
assert ATTR_MAX_TEMP not in state.attributes
|
||||||
|
assert ATTR_FRIENDLY_NAME in state.attributes
|
||||||
|
|
Loading…
Add table
Reference in a new issue