mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Allow storing other items than untyped dict in StorageCollection (#90932)
Allow storing other items than untyped dict in StorageCollection
This commit is contained in:
@@ -82,7 +82,7 @@ class MockObservableCollection(collection.ObservableCollection):
|
||||
return entity_class.from_storage(config)
|
||||
|
||||
|
||||
class MockStorageCollection(collection.StorageCollection):
|
||||
class MockStorageCollection(collection.DictStorageCollection):
|
||||
"""Mock storage collection."""
|
||||
|
||||
async def _process_create_data(self, data: dict) -> dict:
|
||||
@@ -96,9 +96,9 @@ class MockStorageCollection(collection.StorageCollection):
|
||||
"""Suggest an ID based on the config."""
|
||||
return info["name"]
|
||||
|
||||
async def _update_data(self, data: dict, update_data: dict) -> dict:
|
||||
async def _update_data(self, item: dict, update_data: dict) -> dict:
|
||||
"""Return a new updated data object."""
|
||||
return {**data, **update_data}
|
||||
return {**item, **update_data}
|
||||
|
||||
|
||||
def test_id_manager() -> None:
|
||||
|
||||
Reference in New Issue
Block a user