From 6a6eef25b8967dbbdb1aef12cb55bae6314b506b Mon Sep 17 00:00:00 2001 From: Marc Billow Date: Mon, 3 Aug 2026 19:38:57 +0000 Subject: [PATCH] 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. --- tests/test_dryer_drum_clean.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/test_dryer_drum_clean.py b/tests/test_dryer_drum_clean.py index bd3d7e4..fedb8d4 100644 --- a/tests/test_dryer_drum_clean.py +++ b/tests/test_dryer_drum_clean.py @@ -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 == []