mirror of
https://github.com/home-assistant/core.git
synced 2025-11-09 10:59:40 +00:00
Allow inheriting FrozenOrThawed with custom init (#105624)
This commit is contained in:
@@ -1749,3 +1749,15 @@ def test_extending_entity_description(snapshot: SnapshotAssertion):
|
||||
key="blah", extra="foo", mixin="mixin", name="name"
|
||||
)
|
||||
assert repr(obj) == snapshot
|
||||
|
||||
# Try inheriting with custom init
|
||||
@dataclasses.dataclass
|
||||
class CustomInitEntityDescription(entity.EntityDescription):
|
||||
def __init__(self, extra, *args, **kwargs) -> None:
|
||||
super().__init__(*args, **kwargs)
|
||||
self.extra: str = extra
|
||||
|
||||
obj = CustomInitEntityDescription(key="blah", extra="foo", name="name")
|
||||
assert obj == snapshot
|
||||
assert obj == CustomInitEntityDescription(key="blah", extra="foo", name="name")
|
||||
assert repr(obj) == snapshot
|
||||
|
||||
Reference in New Issue
Block a user