1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

De-duplicate test helper function (#143437)

* De-duplicate test helper function

* One more
This commit is contained in:
epenet
2025-04-22 12:04:12 +02:00
committed by GitHub
parent e9269a1d33
commit a3605921c9
12 changed files with 57 additions and 153 deletions

View File

@@ -1911,3 +1911,16 @@ def get_quality_scale(integration: str) -> dict[str, QualityScaleStatus]:
)
for rule, details in raw["rules"].items()
}
def get_schema_suggested_value(schema: vol.Schema, key: str) -> Any | None:
"""Get suggested value for key in voluptuous schema."""
for schema_key in schema:
if schema_key == key:
if (
schema_key.description is None
or "suggested_value" not in schema_key.description
):
return None
return schema_key.description["suggested_value"]
return None