From e34c42c0a90832b4117fe3c30f58e7002f5128c3 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Thu, 13 Jun 2024 16:47:53 +0200 Subject: [PATCH] Fix dangerous-default-value warnings in greeneye_monitor tests (#119581) --- tests/components/greeneye_monitor/conftest.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/components/greeneye_monitor/conftest.py b/tests/components/greeneye_monitor/conftest.py index 975a0119313..ad8a98ce3fe 100644 --- a/tests/components/greeneye_monitor/conftest.py +++ b/tests/components/greeneye_monitor/conftest.py @@ -19,13 +19,15 @@ def assert_sensor_state( hass: HomeAssistant, entity_id: str, expected_state: str, - attributes: dict[str, Any] = {}, + attributes: dict[str, Any] | None = None, ) -> None: """Assert that the given entity has the expected state and at least the provided attributes.""" state = hass.states.get(entity_id) assert state actual_state = state.state assert actual_state == expected_state + if not attributes: + return for key, value in attributes.items(): assert key in state.attributes assert state.attributes[key] == value