mirror of
https://github.com/python-kasa/python-kasa.git
synced 2026-09-20 04:53:52 +00:00
tests: add type annotations to Smart tests (#1686)
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
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.
This commit is contained in:
@@ -2,6 +2,7 @@ import pytest
|
||||
from pytest_mock import MockerFixture
|
||||
|
||||
from kasa import Device, Module
|
||||
from kasa.smart import SmartDevice
|
||||
|
||||
from ...device_fixtures import get_parent_and_child_modules, parametrize
|
||||
|
||||
@@ -20,7 +21,9 @@ powerprotection = parametrize(
|
||||
("power_protection_threshold", "protection_threshold", int),
|
||||
],
|
||||
)
|
||||
async def test_features(dev, feature, prop_name, type):
|
||||
async def test_features(
|
||||
dev: SmartDevice, feature: str, prop_name: str, type: type
|
||||
) -> None:
|
||||
"""Test that features are registered and work as expected."""
|
||||
powerprot = next(get_parent_and_child_modules(dev, Module.PowerProtection))
|
||||
assert powerprot
|
||||
@@ -35,7 +38,7 @@ async def test_features(dev, feature, prop_name, type):
|
||||
|
||||
|
||||
@powerprotection
|
||||
async def test_set_enable(dev: Device, mocker: MockerFixture):
|
||||
async def test_set_enable(dev: Device, mocker: MockerFixture) -> None:
|
||||
"""Test enable."""
|
||||
powerprot = next(get_parent_and_child_modules(dev, Module.PowerProtection))
|
||||
assert powerprot
|
||||
@@ -88,7 +91,7 @@ async def test_set_enable(dev: Device, mocker: MockerFixture):
|
||||
|
||||
|
||||
@powerprotection
|
||||
async def test_set_threshold(dev: Device, mocker: MockerFixture):
|
||||
async def test_set_threshold(dev: Device, mocker: MockerFixture) -> None:
|
||||
"""Test enable."""
|
||||
powerprot = next(get_parent_and_child_modules(dev, Module.PowerProtection))
|
||||
assert powerprot
|
||||
|
||||
Reference in New Issue
Block a user