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:
1 parent
da25d567cb
commit
6a6eef25b8
1 file changed
+7
-6
@@ -16,23 +16,24 @@ from custom_components.localthings.registry.discovery import discover
|
|||||||
from tests.conftest import _load_device
|
from tests.conftest import _load_device
|
||||||
|
|
||||||
|
|
||||||
def _state(fixture_name):
|
def _dryer(fixture_name):
|
||||||
resources = _load_device(fixture_name)
|
resources = _load_device(fixture_name)
|
||||||
info = resources["/information/vs/0"]
|
info = resources["/information/vs/0"]
|
||||||
reg = for_device_by_model(
|
reg = for_device_by_model(
|
||||||
info["x.com.samsung.da.modelNum"],
|
info["x.com.samsung.da.modelNum"],
|
||||||
info["x.com.samsung.da.description"],
|
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)
|
bound = discover(resources, reg.capabilities, reg.pattern_capabilities)
|
||||||
return flatten(bound, resources)
|
return flatten(bound, resources)
|
||||||
|
|
||||||
|
|
||||||
def test_no_unbound_hrefs():
|
def test_no_unbound_hrefs():
|
||||||
resources = _load_device("dryer_tp1_21_drum_clean")
|
reg, resources = _dryer("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"]
|
|
||||||
)
|
|
||||||
unbound = []
|
unbound = []
|
||||||
discover(resources, reg.capabilities, reg.pattern_capabilities, log=unbound.append)
|
discover(resources, reg.capabilities, reg.pattern_capabilities, log=unbound.append)
|
||||||
assert unbound == []
|
assert unbound == []
|
||||||
|
|||||||
Reference in new issue
Block a user