Fix dangerous-default-value warnings in greeneye_monitor tests (#119581)
This commit is contained in:
parent
9f322b20d1
commit
e34c42c0a9
1 changed files with 3 additions and 1 deletions
|
@ -19,13 +19,15 @@ def assert_sensor_state(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
entity_id: str,
|
entity_id: str,
|
||||||
expected_state: str,
|
expected_state: str,
|
||||||
attributes: dict[str, Any] = {},
|
attributes: dict[str, Any] | None = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Assert that the given entity has the expected state and at least the provided attributes."""
|
"""Assert that the given entity has the expected state and at least the provided attributes."""
|
||||||
state = hass.states.get(entity_id)
|
state = hass.states.get(entity_id)
|
||||||
assert state
|
assert state
|
||||||
actual_state = state.state
|
actual_state = state.state
|
||||||
assert actual_state == expected_state
|
assert actual_state == expected_state
|
||||||
|
if not attributes:
|
||||||
|
return
|
||||||
for key, value in attributes.items():
|
for key, value in attributes.items():
|
||||||
assert key in state.attributes
|
assert key in state.attributes
|
||||||
assert state.attributes[key] == value
|
assert state.attributes[key] == value
|
||||||
|
|
Loading…
Add table
Reference in a new issue