Fix ty type-check failures in new tests (CI)

My local ty runs only covered custom_components, not tests -- CI runs
'ty check custom_components tests', which this branch had been failing
since the version-bump commit. All 13 diagnostics were the same two
established idioms this test suite already uses elsewhere, just missing
here:

- desc.write_fn/options_field are SelectDesc-only fields, unresolved on
  the SamsungEntityDescription base a bare 'next(e for e in ... if
  e.key == ...)' infers -- needs 'and isinstance(e, SelectDesc)' in the
  filter, same as test_fridge_capabilities.py's existing selects.
- rep_fn/match_fn are typed Optional even after narrowing to a concrete
  descriptor/capability, so calling one needs an explicit
  'assert x.rep_fn is not None' first, same as
  test_common_capabilities.py's POWER_VS_FALLBACK.match_fn precedent.

No behavior change -- test bodies are identical, just type-checkable.
This commit is contained in:
Marc Billow committed 2026-08-09 01:25:23 +00:00
1 parent 1f7bdc9ac6
commit d2787327fd
4 files changed
+14 -2

No files matched your search

@@ -784,6 +784,7 @@ def test_air_filter_usage_hours_derived_from_percent_and_capacity():
for e in airconditioner.AIR_FILTER.entities
if e.key == "air_filter_usage_hours" and isinstance(e, SensorDesc)
)
assert desc.rep_fn is not None
assert (
desc.rep_fn(
{"x.com.samsung.da.filterUsage": "91", "x.com.samsung.da.filterCapacity": "500"}