Fix ty type error in test_dryer_drum_clean.py
for_device_by_model returns DeviceRegistry | None; accessing .capabilities directly off the inline call result left the None case unnarrowed. Switched to the same reg/resources-tuple helper pattern every other by-model test file in this suite already uses, which ty resolves cleanly.
This commit is contained in:
@@ -16,23 +16,24 @@ from custom_components.localthings.registry.discovery import discover
|
||||
from tests.conftest import _load_device
|
||||
|
||||
|
||||
def _state(fixture_name):
|
||||
def _dryer(fixture_name):
|
||||
resources = _load_device(fixture_name)
|
||||
info = resources["/information/vs/0"]
|
||||
reg = for_device_by_model(
|
||||
info["x.com.samsung.da.modelNum"],
|
||||
info["x.com.samsung.da.description"],
|
||||
)
|
||||
return reg, resources
|
||||
|
||||
|
||||
def _state(fixture_name):
|
||||
reg, resources = _dryer(fixture_name)
|
||||
bound = discover(resources, reg.capabilities, reg.pattern_capabilities)
|
||||
return flatten(bound, resources)
|
||||
|
||||
|
||||
def test_no_unbound_hrefs():
|
||||
resources = _load_device("dryer_tp1_21_drum_clean")
|
||||
info = resources["/information/vs/0"]
|
||||
reg = for_device_by_model(
|
||||
info["x.com.samsung.da.modelNum"], info["x.com.samsung.da.description"]
|
||||
)
|
||||
reg, resources = _dryer("dryer_tp1_21_drum_clean")
|
||||
unbound = []
|
||||
discover(resources, reg.capabilities, reg.pattern_capabilities, log=unbound.append)
|
||||
assert unbound == []
|
||||
|
||||
Reference in New Issue
Block a user