Files
shelly-ui/tests/test_config_patch.py
jonas 71803418e5 Initial commit: Shelly Manager with Textual CLI, Streamlit UI, and comprehensive .gitignore
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.
2026-03-23 21:51:59 +01:00

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}}