mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Use ReadOnlyDict for entity registry options (#93824)
* Use ReadOnlyDict for entity registry options While reviewing #93601 it was noticed this was slow at startup https://github.com/home-assistant/core/pull/93601#issuecomment-1568958280 This is a first pass attempt to improve the performance * fix tests
This commit is contained in:
@@ -748,13 +748,13 @@ async def test_update_entity_options(entity_registry: er.EntityRegistry) -> None
|
||||
assert new_entry_1.options == {"light": {"minimum_brightness": 20}}
|
||||
|
||||
# Test it's not possible to modify the options
|
||||
with pytest.raises(NotImplementedError):
|
||||
with pytest.raises(RuntimeError):
|
||||
new_entry_1.options["blah"] = {}
|
||||
with pytest.raises(NotImplementedError):
|
||||
with pytest.raises(RuntimeError):
|
||||
new_entry_1.options["light"] = {}
|
||||
with pytest.raises(TypeError):
|
||||
with pytest.raises(RuntimeError):
|
||||
new_entry_1.options["light"]["blah"] = 123
|
||||
with pytest.raises(TypeError):
|
||||
with pytest.raises(RuntimeError):
|
||||
new_entry_1.options["light"]["minimum_brightness"] = 123
|
||||
|
||||
entity_registry.async_update_entity_options(
|
||||
|
||||
Reference in New Issue
Block a user