tests: add type annotations to Smart tests (#1686)
Some checks are pending
CI / Perform Lint Checks (3.14) (push) Waiting to run
CI / Python 3.11 on macos-latest (push) Blocked by required conditions
CI / Python 3.12 on macos-latest (push) Blocked by required conditions
CI / Python 3.13 on macos-latest (push) Blocked by required conditions
CI / Python 3.14 on macos-latest (push) Blocked by required conditions
CI / Python 3.11 on ubuntu-latest (push) Blocked by required conditions
CI / Python 3.12 on ubuntu-latest (push) Blocked by required conditions
CI / Python 3.13 on ubuntu-latest (push) Blocked by required conditions
CI / Python 3.14 on ubuntu-latest (push) Blocked by required conditions
CI / Python 3.11 on windows-latest (push) Blocked by required conditions
CI / Python 3.12 on windows-latest (push) Blocked by required conditions
CI / Python 3.13 on windows-latest (push) Blocked by required conditions
CI / Python 3.14 on windows-latest (push) Blocked by required conditions
CodeQL Checks / Analyze (python) (push) Waiting to run

Add type annotations across all 'smart' tests, enabling mypy to check test function bodies, catching type errors that were previously hidden.
This commit is contained in:
ZeliardM
2026-07-07 18:11:59 -04:00
committed by GitHub
parent 8840fc395e
commit 88e1c27bd0
30 changed files with 192 additions and 125 deletions

View File

@@ -1,6 +1,7 @@
import pytest
from kasa.smart.modules import HumiditySensor
from kasa import Module
from kasa.smart import SmartDevice
from ...device_fixtures import parametrize
@@ -17,9 +18,9 @@ humidity = parametrize(
("humidity_warning", bool),
],
)
async def test_humidity_features(dev, feature, type):
async def test_humidity_features(dev: SmartDevice, feature: str, type: type) -> None:
"""Test that features are registered and work as expected."""
humidity: HumiditySensor = dev.modules["HumiditySensor"]
humidity = dev.modules[Module.HumiditySensor]
prop = getattr(humidity, feature)
assert isinstance(prop, type)