- Make href Optional[str] = None for pattern capabilities - Remove observe field (v2 architecture observes all hrefs) - Add rt_filter, match_fn, key_fn fields to Capability - Add entities default value tuple[()] to Capability - Add key_override field to BoundEntity - Update _key() to use key_override when present - Update _make_observe_paths() to observe all unique hrefs (OBSERVE as accelerator) - Guard _build() to skip pattern capabilities (href is None) - Add test_bound_entity_key_override_takes_precedence test - Update test_capability_defaults to remove observe assertion All 61 tests passing (60 existing + 1 new).
20 lines
623 B
Python
20 lines
623 B
Python
from samsung_appliance.registry.capability import Capability
|
|
from samsung_appliance.registry.entities import BinarySensorDesc
|
|
|
|
|
|
def test_capability_defaults():
|
|
c = Capability(href='/kidslock/vs/0',
|
|
entities=(BinarySensorDesc(key='child_lock', field='x.com.samsung.da.kidsLock'),))
|
|
assert c.poll_tier == 'warm'
|
|
assert c.active_when is None
|
|
assert len(c.entities) == 1
|
|
|
|
|
|
def test_capability_is_frozen():
|
|
c = Capability(href='/kidslock/vs/0', entities=())
|
|
try:
|
|
c.href = '/other/vs/0'
|
|
except Exception:
|
|
return
|
|
raise AssertionError("expected frozen dataclass")
|