python-duco-connectivity 0.13.0__tar.gz → 0.13.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_duco_connectivity-0.13.0/src/python_duco_connectivity.egg-info → python_duco_connectivity-0.13.1}/PKG-INFO +5 -2
- {python_duco_connectivity-0.13.0 → python_duco_connectivity-0.13.1}/README.md +4 -1
- {python_duco_connectivity-0.13.0 → python_duco_connectivity-0.13.1}/pyproject.toml +1 -1
- {python_duco_connectivity-0.13.0 → python_duco_connectivity-0.13.1}/src/duco_connectivity/models.py +41 -1
- {python_duco_connectivity-0.13.0 → python_duco_connectivity-0.13.1/src/python_duco_connectivity.egg-info}/PKG-INFO +5 -2
- {python_duco_connectivity-0.13.0 → python_duco_connectivity-0.13.1}/tests/test_models.py +84 -0
- {python_duco_connectivity-0.13.0 → python_duco_connectivity-0.13.1}/LICENSE +0 -0
- {python_duco_connectivity-0.13.0 → python_duco_connectivity-0.13.1}/setup.cfg +0 -0
- {python_duco_connectivity-0.13.0 → python_duco_connectivity-0.13.1}/src/duco_connectivity/__init__.py +0 -0
- {python_duco_connectivity-0.13.0 → python_duco_connectivity-0.13.1}/src/duco_connectivity/__main__.py +0 -0
- {python_duco_connectivity-0.13.0 → python_duco_connectivity-0.13.1}/src/duco_connectivity/cli.py +0 -0
- {python_duco_connectivity-0.13.0 → python_duco_connectivity-0.13.1}/src/duco_connectivity/client.py +0 -0
- {python_duco_connectivity-0.13.0 → python_duco_connectivity-0.13.1}/src/duco_connectivity/exceptions.py +0 -0
- {python_duco_connectivity-0.13.0 → python_duco_connectivity-0.13.1}/src/duco_connectivity/py.typed +0 -0
- {python_duco_connectivity-0.13.0 → python_duco_connectivity-0.13.1}/src/python_duco_connectivity.egg-info/SOURCES.txt +0 -0
- {python_duco_connectivity-0.13.0 → python_duco_connectivity-0.13.1}/src/python_duco_connectivity.egg-info/dependency_links.txt +0 -0
- {python_duco_connectivity-0.13.0 → python_duco_connectivity-0.13.1}/src/python_duco_connectivity.egg-info/entry_points.txt +0 -0
- {python_duco_connectivity-0.13.0 → python_duco_connectivity-0.13.1}/src/python_duco_connectivity.egg-info/requires.txt +0 -0
- {python_duco_connectivity-0.13.0 → python_duco_connectivity-0.13.1}/src/python_duco_connectivity.egg-info/top_level.txt +0 -0
- {python_duco_connectivity-0.13.0 → python_duco_connectivity-0.13.1}/tests/test_api_reference.py +0 -0
- {python_duco_connectivity-0.13.0 → python_duco_connectivity-0.13.1}/tests/test_cli.py +0 -0
- {python_duco_connectivity-0.13.0 → python_duco_connectivity-0.13.1}/tests/test_client.py +0 -0
- {python_duco_connectivity-0.13.0 → python_duco_connectivity-0.13.1}/tests/test_exceptions.py +0 -0
- {python_duco_connectivity-0.13.0 → python_duco_connectivity-0.13.1}/tests/test_local_sample_validation.py +0 -0
- {python_duco_connectivity-0.13.0 → python_duco_connectivity-0.13.1}/tests/test_pytest_live_support.py +0 -0
- {python_duco_connectivity-0.13.0 → python_duco_connectivity-0.13.1}/tests/test_replay_helpers.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-duco-connectivity
|
|
3
|
-
Version: 0.13.
|
|
3
|
+
Version: 0.13.1
|
|
4
4
|
Summary: Async HTTP client for the local Duco Connectivity API
|
|
5
5
|
Author: Ronald van der Meer
|
|
6
6
|
License-Expression: MIT
|
|
@@ -84,7 +84,10 @@ Diagnostic subsystem reads expose known status values as normalized `DiagStatus`
|
|
|
84
84
|
members (`ok`, `disabled`, or `error`). Each `DiagComponent` also keeps the exact
|
|
85
85
|
API value in `raw_status`; an unrecognized future value produces `status=None`
|
|
86
86
|
without discarding the raw value. Subsystem names remain unfiltered so future
|
|
87
|
-
components are available to downstream consumers.
|
|
87
|
+
components are available to downstream consumers. Direct construction using a
|
|
88
|
+
pre-0.13 raw status string remains compatible and derives `raw_status`
|
|
89
|
+
automatically; callers using a normalized `DiagStatus` must provide
|
|
90
|
+
`raw_status` explicitly.
|
|
88
91
|
|
|
89
92
|
## Getting started
|
|
90
93
|
|
|
@@ -52,7 +52,10 @@ Diagnostic subsystem reads expose known status values as normalized `DiagStatus`
|
|
|
52
52
|
members (`ok`, `disabled`, or `error`). Each `DiagComponent` also keeps the exact
|
|
53
53
|
API value in `raw_status`; an unrecognized future value produces `status=None`
|
|
54
54
|
without discarding the raw value. Subsystem names remain unfiltered so future
|
|
55
|
-
components are available to downstream consumers.
|
|
55
|
+
components are available to downstream consumers. Direct construction using a
|
|
56
|
+
pre-0.13 raw status string remains compatible and derives `raw_status`
|
|
57
|
+
automatically; callers using a normalized `DiagStatus` must provide
|
|
58
|
+
`raw_status` explicitly.
|
|
56
59
|
|
|
57
60
|
## Getting started
|
|
58
61
|
|
{python_duco_connectivity-0.13.0 → python_duco_connectivity-0.13.1}/src/duco_connectivity/models.py
RENAMED
|
@@ -1575,7 +1575,7 @@ class NodeOverview:
|
|
|
1575
1575
|
raw_payload: dict[str, Any] = field(default_factory=dict, repr=False, compare=False)
|
|
1576
1576
|
|
|
1577
1577
|
|
|
1578
|
-
@dataclass(frozen=True, slots=True)
|
|
1578
|
+
@dataclass(frozen=True, slots=True, init=False)
|
|
1579
1579
|
class DiagComponent:
|
|
1580
1580
|
"""Health state for a diagnostic subsystem."""
|
|
1581
1581
|
|
|
@@ -1584,6 +1584,46 @@ class DiagComponent:
|
|
|
1584
1584
|
raw_status: str
|
|
1585
1585
|
raw_payload: dict[str, Any] = field(default_factory=dict, repr=False, compare=False)
|
|
1586
1586
|
|
|
1587
|
+
def __init__(
|
|
1588
|
+
self,
|
|
1589
|
+
component: str,
|
|
1590
|
+
status: DiagStatus | str | None,
|
|
1591
|
+
raw_status: str | dict[str, Any] | None = None,
|
|
1592
|
+
raw_payload: dict[str, Any] | None = None,
|
|
1593
|
+
) -> None:
|
|
1594
|
+
"""Initialize a diagnostic subsystem with legacy argument compatibility."""
|
|
1595
|
+
if isinstance(raw_status, dict):
|
|
1596
|
+
if raw_payload is not None:
|
|
1597
|
+
raise TypeError("raw_payload was provided more than once")
|
|
1598
|
+
raw_payload = raw_status
|
|
1599
|
+
raw_status = None
|
|
1600
|
+
if raw_status is not None and not isinstance(raw_status, str):
|
|
1601
|
+
raise TypeError("raw_status must be a string")
|
|
1602
|
+
if (
|
|
1603
|
+
isinstance(status, str)
|
|
1604
|
+
and not isinstance(status, DiagStatus)
|
|
1605
|
+
and raw_status is not None
|
|
1606
|
+
and raw_status != status
|
|
1607
|
+
):
|
|
1608
|
+
raise ValueError("raw_status must match status for raw API strings")
|
|
1609
|
+
|
|
1610
|
+
normalized_status: DiagStatus | None
|
|
1611
|
+
if isinstance(status, DiagStatus):
|
|
1612
|
+
normalized_status = status
|
|
1613
|
+
elif isinstance(status, str):
|
|
1614
|
+
normalized_status = DiagStatus.from_api_value(status)
|
|
1615
|
+
else:
|
|
1616
|
+
normalized_status = None
|
|
1617
|
+
if raw_status is None:
|
|
1618
|
+
if not isinstance(status, str) or isinstance(status, DiagStatus):
|
|
1619
|
+
raise TypeError("raw_status is required unless status is a raw API string")
|
|
1620
|
+
raw_status = status
|
|
1621
|
+
|
|
1622
|
+
object.__setattr__(self, "component", component)
|
|
1623
|
+
object.__setattr__(self, "status", normalized_status)
|
|
1624
|
+
object.__setattr__(self, "raw_status", raw_status)
|
|
1625
|
+
object.__setattr__(self, "raw_payload", {} if raw_payload is None else raw_payload)
|
|
1626
|
+
|
|
1587
1627
|
|
|
1588
1628
|
@dataclass(frozen=True, slots=True)
|
|
1589
1629
|
class DiagInfo:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-duco-connectivity
|
|
3
|
-
Version: 0.13.
|
|
3
|
+
Version: 0.13.1
|
|
4
4
|
Summary: Async HTTP client for the local Duco Connectivity API
|
|
5
5
|
Author: Ronald van der Meer
|
|
6
6
|
License-Expression: MIT
|
|
@@ -84,7 +84,10 @@ Diagnostic subsystem reads expose known status values as normalized `DiagStatus`
|
|
|
84
84
|
members (`ok`, `disabled`, or `error`). Each `DiagComponent` also keeps the exact
|
|
85
85
|
API value in `raw_status`; an unrecognized future value produces `status=None`
|
|
86
86
|
without discarding the raw value. Subsystem names remain unfiltered so future
|
|
87
|
-
components are available to downstream consumers.
|
|
87
|
+
components are available to downstream consumers. Direct construction using a
|
|
88
|
+
pre-0.13 raw status string remains compatible and derives `raw_status`
|
|
89
|
+
automatically; callers using a normalized `DiagStatus` must provide
|
|
90
|
+
`raw_status` explicitly.
|
|
88
91
|
|
|
89
92
|
## Getting started
|
|
90
93
|
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import inspect
|
|
4
4
|
import logging
|
|
5
|
+
from typing import cast
|
|
5
6
|
|
|
6
7
|
import pytest
|
|
7
8
|
|
|
@@ -41,6 +42,8 @@ from duco_connectivity import (
|
|
|
41
42
|
ConfigZonesOverview,
|
|
42
43
|
ConfigZoneStruct,
|
|
43
44
|
DeviceGroupConfigSubmoduleSelector,
|
|
45
|
+
DiagComponent,
|
|
46
|
+
DiagStatus,
|
|
44
47
|
DucoSerialNumber,
|
|
45
48
|
DucoVersion,
|
|
46
49
|
HostName,
|
|
@@ -275,6 +278,87 @@ def test_selector_enum_values() -> None:
|
|
|
275
278
|
assert DeviceGroupConfigSubmoduleSelector.GENERAL.value == "General"
|
|
276
279
|
|
|
277
280
|
|
|
281
|
+
@pytest.mark.parametrize(
|
|
282
|
+
("raw_status", "expected_status"),
|
|
283
|
+
[
|
|
284
|
+
pytest.param("Ok", DiagStatus.OK, id="ok"),
|
|
285
|
+
pytest.param("Disable", DiagStatus.DISABLED, id="disabled"),
|
|
286
|
+
pytest.param("Error", DiagStatus.ERROR, id="error"),
|
|
287
|
+
pytest.param("FutureState", None, id="unknown"),
|
|
288
|
+
],
|
|
289
|
+
)
|
|
290
|
+
def test_diag_component_accepts_legacy_raw_status(
|
|
291
|
+
raw_status: str, expected_status: DiagStatus | None
|
|
292
|
+
) -> None:
|
|
293
|
+
"""DiagComponent should normalize status strings accepted before version 0.13."""
|
|
294
|
+
raw_payload = {"Status": raw_status}
|
|
295
|
+
|
|
296
|
+
component = DiagComponent(
|
|
297
|
+
component="Ventilation",
|
|
298
|
+
status=raw_status,
|
|
299
|
+
raw_payload=raw_payload,
|
|
300
|
+
)
|
|
301
|
+
|
|
302
|
+
assert component.status is expected_status
|
|
303
|
+
assert component.raw_status == raw_status
|
|
304
|
+
assert component.raw_payload is raw_payload
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
def test_diag_component_accepts_legacy_positional_raw_payload() -> None:
|
|
308
|
+
"""DiagComponent should retain the legacy positional raw payload argument."""
|
|
309
|
+
raw_payload = {"Status": "Ok"}
|
|
310
|
+
|
|
311
|
+
component = DiagComponent("Ventilation", "Ok", raw_payload)
|
|
312
|
+
|
|
313
|
+
assert component.status is DiagStatus.OK
|
|
314
|
+
assert component.raw_status == "Ok"
|
|
315
|
+
assert component.raw_payload is raw_payload
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
def test_diag_component_accepts_normalized_status() -> None:
|
|
319
|
+
"""DiagComponent should retain the explicit normalized status contract."""
|
|
320
|
+
component = DiagComponent(
|
|
321
|
+
component="Ventilation",
|
|
322
|
+
status=DiagStatus.OK,
|
|
323
|
+
raw_status="Ok",
|
|
324
|
+
)
|
|
325
|
+
|
|
326
|
+
assert component.status is DiagStatus.OK
|
|
327
|
+
assert component.raw_status == "Ok"
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
def test_diag_component_rejects_conflicting_legacy_raw_status() -> None:
|
|
331
|
+
"""DiagComponent should reject conflicting legacy raw status values."""
|
|
332
|
+
with pytest.raises(ValueError, match="raw_status must match status"):
|
|
333
|
+
DiagComponent(
|
|
334
|
+
component="Ventilation",
|
|
335
|
+
status="Ok",
|
|
336
|
+
raw_status="Error",
|
|
337
|
+
)
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
def test_diag_component_accepts_matching_legacy_raw_status() -> None:
|
|
341
|
+
"""DiagComponent should accept matching explicit legacy raw status values."""
|
|
342
|
+
component = DiagComponent(
|
|
343
|
+
component="Ventilation",
|
|
344
|
+
status="Ok",
|
|
345
|
+
raw_status="Ok",
|
|
346
|
+
)
|
|
347
|
+
|
|
348
|
+
assert component.status is DiagStatus.OK
|
|
349
|
+
assert component.raw_status == "Ok"
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
def test_diag_component_rejects_non_string_raw_status() -> None:
|
|
353
|
+
"""DiagComponent should reject non-string raw status values."""
|
|
354
|
+
with pytest.raises(TypeError, match="raw_status must be a string"):
|
|
355
|
+
DiagComponent(
|
|
356
|
+
component="Ventilation",
|
|
357
|
+
status=DiagStatus.OK,
|
|
358
|
+
raw_status=cast(str, 42),
|
|
359
|
+
)
|
|
360
|
+
|
|
361
|
+
|
|
278
362
|
def test_board_name_known_value() -> None:
|
|
279
363
|
"""BoardName should expose observed stable board identities."""
|
|
280
364
|
board_name = BoardName("SILENT_CONNECT")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_duco_connectivity-0.13.0 → python_duco_connectivity-0.13.1}/src/duco_connectivity/cli.py
RENAMED
|
File without changes
|
{python_duco_connectivity-0.13.0 → python_duco_connectivity-0.13.1}/src/duco_connectivity/client.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_duco_connectivity-0.13.0 → python_duco_connectivity-0.13.1}/src/duco_connectivity/py.typed
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_duco_connectivity-0.13.0 → python_duco_connectivity-0.13.1}/tests/test_api_reference.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_duco_connectivity-0.13.0 → python_duco_connectivity-0.13.1}/tests/test_exceptions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_duco_connectivity-0.13.0 → python_duco_connectivity-0.13.1}/tests/test_replay_helpers.py
RENAMED
|
File without changes
|