Fix hidden default (#70699)
parent
791138eb8b
commit
5317bf02e6
|
@ -230,7 +230,7 @@ class EntityDescription:
|
|||
device_class: str | None = None
|
||||
entity_category: EntityCategory | None = None
|
||||
entity_registry_enabled_default: bool = True
|
||||
entity_registry_visible_default: bool = False
|
||||
entity_registry_visible_default: bool = True
|
||||
force_update: bool = False
|
||||
icon: str | None = None
|
||||
name: str | None = None
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""Test the entity helper."""
|
||||
# pylint: disable=protected-access
|
||||
import asyncio
|
||||
import dataclasses
|
||||
from datetime import timedelta
|
||||
import threading
|
||||
from unittest.mock import MagicMock, PropertyMock, patch
|
||||
|
@ -932,3 +933,16 @@ def test_entity_category_schema_error(value):
|
|||
match=r"expected EntityCategory or one of 'config', 'diagnostic', 'system'",
|
||||
):
|
||||
schema(value)
|
||||
|
||||
|
||||
async def test_entity_description_fallback():
|
||||
"""Test entity description has same defaults as entity."""
|
||||
ent = entity.Entity()
|
||||
ent_with_description = entity.Entity()
|
||||
ent_with_description.entity_description = entity.EntityDescription(key="test")
|
||||
|
||||
for field in dataclasses.fields(entity.EntityDescription):
|
||||
if field.name == "key":
|
||||
continue
|
||||
|
||||
assert getattr(ent, field.name) == getattr(ent_with_description, field.name)
|
||||
|
|
Loading…
Reference in New Issue