mirror of
https://github.com/python-kasa/python-kasa.git
synced 2026-07-11 09:52:04 +00:00
Some checks failed
CI / Perform Lint Checks (3.14) (push) Has been cancelled
CodeQL Checks / Analyze (python) (push) Has been cancelled
CI / Python 3.11 on macos-latest (push) Has been cancelled
CI / Python 3.12 on macos-latest (push) Has been cancelled
CI / Python 3.13 on macos-latest (push) Has been cancelled
CI / Python 3.14 on macos-latest (push) Has been cancelled
CI / Python 3.11 on ubuntu-latest (push) Has been cancelled
CI / Python 3.12 on ubuntu-latest (push) Has been cancelled
CI / Python 3.13 on ubuntu-latest (push) Has been cancelled
CI / Python 3.14 on ubuntu-latest (push) Has been cancelled
CI / Python 3.11 on windows-latest (push) Has been cancelled
CI / Python 3.12 on windows-latest (push) Has been cancelled
CI / Python 3.13 on windows-latest (push) Has been cancelled
CI / Python 3.14 on windows-latest (push) Has been cancelled
Stale / stale (push) Has been cancelled
Add type annotations across all 'smart' tests, enabling mypy to check test function bodies, catching type errors that were previously hidden.
30 lines
704 B
Python
30 lines
704 B
Python
import pytest
|
|
|
|
from kasa import Device, Module
|
|
|
|
from ...device_fixtures import parametrize
|
|
|
|
contact = parametrize(
|
|
"is contact sensor", model_filter="T110", protocol_filter={"SMART.CHILD"}
|
|
)
|
|
|
|
|
|
@contact
|
|
@pytest.mark.parametrize(
|
|
("feature", "type"),
|
|
[
|
|
("is_open", bool),
|
|
],
|
|
)
|
|
async def test_contact_features(dev: Device, feature: str, type: type) -> None:
|
|
"""Test that features are registered and work as expected."""
|
|
contact = dev.modules.get(Module.ContactSensor)
|
|
assert contact is not None
|
|
|
|
prop = getattr(contact, feature)
|
|
assert isinstance(prop, type)
|
|
|
|
feat = dev.features[feature]
|
|
assert feat.value == prop
|
|
assert isinstance(feat.value, type)
|