mirror of
https://github.com/python-kasa/python-kasa.git
synced 2026-07-08 14:52:03 +00:00
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
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:
@@ -22,7 +22,9 @@ dustbin = parametrize(
|
||||
("dustbin_mode", "mode", str),
|
||||
],
|
||||
)
|
||||
async def test_features(dev: SmartDevice, feature: str, prop_name: str, type: type):
|
||||
async def test_features(
|
||||
dev: SmartDevice, feature: str, prop_name: str, type: type
|
||||
) -> None:
|
||||
"""Test that features are registered and work as expected."""
|
||||
dustbin = next(get_parent_and_child_modules(dev, Module.Dustbin))
|
||||
assert dustbin is not None
|
||||
@@ -36,7 +38,7 @@ async def test_features(dev: SmartDevice, feature: str, prop_name: str, type: ty
|
||||
|
||||
|
||||
@dustbin
|
||||
async def test_dustbin_mode(dev: SmartDevice, mocker: MockerFixture):
|
||||
async def test_dustbin_mode(dev: SmartDevice, mocker: MockerFixture) -> None:
|
||||
"""Test dust mode."""
|
||||
dustbin = next(get_parent_and_child_modules(dev, Module.Dustbin))
|
||||
call = mocker.spy(dustbin, "call")
|
||||
@@ -61,7 +63,7 @@ async def test_dustbin_mode(dev: SmartDevice, mocker: MockerFixture):
|
||||
|
||||
|
||||
@dustbin
|
||||
async def test_dustbin_mode_off(dev: SmartDevice, mocker: MockerFixture):
|
||||
async def test_dustbin_mode_off(dev: SmartDevice, mocker: MockerFixture) -> None:
|
||||
"""Test dustbin_mode == Off."""
|
||||
dustbin = next(get_parent_and_child_modules(dev, Module.Dustbin))
|
||||
call = mocker.spy(dustbin, "call")
|
||||
@@ -80,7 +82,7 @@ async def test_dustbin_mode_off(dev: SmartDevice, mocker: MockerFixture):
|
||||
|
||||
|
||||
@dustbin
|
||||
async def test_autocollection(dev: SmartDevice, mocker: MockerFixture):
|
||||
async def test_autocollection(dev: SmartDevice, mocker: MockerFixture) -> None:
|
||||
"""Test autocollection switch."""
|
||||
dustbin = next(get_parent_and_child_modules(dev, Module.Dustbin))
|
||||
call = mocker.spy(dustbin, "call")
|
||||
@@ -101,7 +103,7 @@ async def test_autocollection(dev: SmartDevice, mocker: MockerFixture):
|
||||
|
||||
|
||||
@dustbin
|
||||
async def test_empty_dustbin(dev: SmartDevice, mocker: MockerFixture):
|
||||
async def test_empty_dustbin(dev: SmartDevice, mocker: MockerFixture) -> None:
|
||||
"""Test the empty dustbin feature."""
|
||||
dustbin = next(get_parent_and_child_modules(dev, Module.Dustbin))
|
||||
call = mocker.spy(dustbin, "call")
|
||||
|
||||
Reference in New Issue
Block a user