tests: add type annotations to IoT tests (#1685)

Add type annotations to all test functions across 8 files in `tests/iot/`, improving type safety and enabling mypy to check function bodies.
This commit is contained in:
ZeliardM
2026-07-05 12:31:48 -04:00
committed by GitHub
parent bb27a43027
commit da2588291d
15 changed files with 151 additions and 126 deletions

View File

@@ -4,10 +4,10 @@ from unittest.mock import Mock
from kasa.iot.modules import Usage
def test_usage_convert_stat_data():
usage = Usage(None, module="usage")
def test_usage_convert_stat_data() -> None:
usage = Usage(Mock(), module="usage")
test_data = []
test_data: list[dict[str, int]] = []
assert usage._convert_stat_data(test_data, "day") == {}
test_data = [
@@ -24,13 +24,13 @@ def test_usage_convert_stat_data():
assert v == 30
def test_usage_today():
def test_usage_today() -> None:
"""Test fetching the usage for today.
This test uses inline data since the fixtures
will not have data for the current day.
"""
emeter_data = {
emeter_data: dict = {
"get_daystat": {
"day_list": [],
"err_code": 0,
@@ -55,13 +55,13 @@ def test_usage_today():
assert usage.usage_today == 500
def test_usage_this_month():
def test_usage_this_month() -> None:
"""Test fetching the usage for this month.
This test uses inline data since the fixtures
will not have data for the current month.
"""
emeter_data = {
emeter_data: dict = {
"get_monthstat": {
"month_list": [],
"err_code": 0,