From c8091e70f622226f4f24635ef23cd383ac0ddcf6 Mon Sep 17 00:00:00 2001 From: Erik Date: Thu, 25 Sep 2025 13:39:27 +0200 Subject: [PATCH] Fix forgotten check for dict --- tests/components/conftest.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/components/conftest.py b/tests/components/conftest.py index 5f477869da30..bd44b45a4378 100644 --- a/tests/components/conftest.py +++ b/tests/components/conftest.py @@ -67,7 +67,9 @@ def patch_restore_sensor() -> Generator[None]: def as_dict(self) -> dict[str, Any]: """Return a dict representation of the sensor data.""" data = real_as_dict(self) - if not (_type := data["native_value"].get("__type")): + if not isinstance(data["native_value"], dict) or not ( + _type := data["native_value"].get("__type") + ): return data if _type == "": data["native_value"]["__type"] = ""