71803418e5
Shelly device management app with mDNS/subnet discovery, inventory, configuration, and mass operations for Gen1/Gen2+ devices. Includes .gitignore excluding runtime data (device DB, user config), AI conversation history, build artifacts, and common Python/OS patterns.
20 lines
598 B
Python
20 lines
598 B
Python
"""config_patch deep merge."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from shelly_manager.core.config_patch import deep_merge_dict
|
|
|
|
|
|
def test_deep_merge_nested() -> None:
|
|
base = {"mqtt": {"enable": True, "server": "old"}, "sys": {"debug": 0}}
|
|
patch = {"mqtt": {"server": "new", "enable": False}}
|
|
out = deep_merge_dict(base, patch)
|
|
assert out["mqtt"]["server"] == "new"
|
|
assert out["mqtt"]["enable"] is False
|
|
assert out["sys"]["debug"] == 0
|
|
|
|
|
|
def test_deep_merge_adds_key() -> None:
|
|
out = deep_merge_dict({"a": 1}, {"b": {"c": 2}})
|
|
assert out == {"a": 1, "b": {"c": 2}}
|