Files
python-kasa/tests/smart/modules/test_humidity.py
ZeliardM 88e1c27bd0
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
tests: add type annotations to Smart tests (#1686)
Add type annotations across all 'smart' tests, enabling mypy to check test function bodies, catching type errors that were previously hidden.
2026-07-08 00:11:59 +02:00

31 lines
746 B
Python

import pytest
from kasa import Module
from kasa.smart import SmartDevice
from ...device_fixtures import parametrize
humidity = parametrize(
"has humidity", component_filter="humidity", protocol_filter={"SMART.CHILD"}
)
@humidity
@pytest.mark.parametrize(
("feature", "type"),
[
("humidity", int),
("humidity_warning", bool),
],
)
async def test_humidity_features(dev: SmartDevice, feature: str, type: type) -> None:
"""Test that features are registered and work as expected."""
humidity = dev.modules[Module.HumiditySensor]
prop = getattr(humidity, feature)
assert isinstance(prop, type)
feat = dev.features[feature]
assert feat.value == prop
assert isinstance(feat.value, type)