Re-raise annotated_yaml.YAMLException as HomeAssistantError (#147129)

* Re-raise annotated_yaml.YAMLException as HomeAssistantError

* Fix comment
This commit is contained in:
Erik Montnemery
2025-06-19 12:52:01 +02:00
committed by GitHub
parent 77dca49c75
commit 5bc2e271d2
2 changed files with 15 additions and 7 deletions

View File

@@ -559,6 +559,10 @@ def test_load_yaml_dict(expected_data: Any) -> None:
@pytest.mark.usefixtures("try_both_loaders", "mock_hass_config_yaml")
def test_load_yaml_dict_fail() -> None:
"""Test item without a key."""
# Make sure we raise a subclass of HomeAssistantError, not
# annotated_yaml.YAMLException
assert issubclass(yaml_loader.YamlTypeError, HomeAssistantError)
with pytest.raises(yaml_loader.YamlTypeError):
yaml_loader.load_yaml_dict(YAML_CONFIG_FILE)