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.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
"""json_path helper tests."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from shelly_manager.core.json_path import get_json_path, is_missing
|
||||
|
||||
|
||||
def test_get_json_path_nested() -> None:
|
||||
d = {"ble": {"enable": True, "rpc": {"enable": False}}}
|
||||
assert get_json_path(d, "ble.enable") is True
|
||||
assert get_json_path(d, "ble.rpc.enable") is False
|
||||
|
||||
|
||||
def test_get_json_path_missing() -> None:
|
||||
assert is_missing(get_json_path({}, "ble.enable"))
|
||||
|
||||
|
||||
def test_get_json_path_empty() -> None:
|
||||
assert is_missing(get_json_path(None, "a")) # type: ignore[arg-type]
|
||||
|
||||
|
||||
def test_get_json_path_pipe_segment() -> None:
|
||||
d = {"switch:0": {"output": True}}
|
||||
assert get_json_path(d, "switch:0|output") is True
|
||||
|
||||
|
||||
def test_get_json_path_list_index() -> None:
|
||||
d = {"relays": [{"ison": True}]}
|
||||
assert get_json_path(d, "relays.0.ison") is True
|
||||
Reference in New Issue
Block a user