Skip to content

Commit 5877c70

Browse files
committed
chore: Fix pre-commit violations (mypy type errors and formatting)
1 parent 8a03863 commit 5877c70

File tree

3 files changed

+18
-21
lines changed

3 files changed

+18
-21
lines changed

tests/devices/rpc/test_b01_q10_channel.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
"""Tests for the b01_q10_channel."""
22

3-
import asyncio
4-
from typing import Any
5-
from unittest.mock import AsyncMock, patch
3+
from unittest.mock import patch
64

75
import pytest
86

@@ -43,7 +41,7 @@ async def test_send_decoded_command_success(mock_mqtt_channel: FakeChannel):
4341

4442
# Call the function
4543
result = await send_decoded_command(
46-
mock_mqtt_channel,
44+
mock_mqtt_channel, # type: ignore[arg-type]
4745
B01_Q10_DP.REQUETDPS,
4846
{},
4947
expected_dps={B01_Q10_DP.STATUS, B01_Q10_DP.BATTERY},
@@ -85,7 +83,7 @@ async def test_send_decoded_command_filters_by_expected_dps(mock_mqtt_channel: F
8583

8684
# Call the function with expected_dps
8785
result = await send_decoded_command(
88-
mock_mqtt_channel,
86+
mock_mqtt_channel, # type: ignore[arg-type]
8987
B01_Q10_DP.REQUETDPS,
9088
{},
9189
expected_dps={B01_Q10_DP.STATUS, B01_Q10_DP.BATTERY},
@@ -105,7 +103,7 @@ async def test_send_decoded_command_timeout():
105103
# Don't add any responses to queue
106104
with pytest.raises(RoborockException, match="timed out"):
107105
await send_decoded_command(
108-
mock_mqtt_channel,
106+
mock_mqtt_channel, # type: ignore[arg-type]
109107
B01_Q10_DP.REQUETDPS,
110108
{},
111109
expected_dps={B01_Q10_DP.STATUS}, # Won't match CLEANING_PROGRESS
@@ -142,7 +140,7 @@ async def test_send_decoded_command_ignores_decode_errors(mock_mqtt_channel: Fak
142140

143141
# Command should still succeed with second response
144142
result = await send_decoded_command(
145-
mock_mqtt_channel,
143+
mock_mqtt_channel, # type: ignore[arg-type]
146144
B01_Q10_DP.REQUETDPS,
147145
{},
148146
expected_dps={B01_Q10_DP.STATUS},
@@ -170,7 +168,7 @@ async def test_send_decoded_command_no_expected_dps_filter():
170168

171169
# Call without expected_dps
172170
result = await send_decoded_command(
173-
mock_mqtt_channel,
171+
mock_mqtt_channel, # type: ignore[arg-type]
174172
B01_Q10_DP.REQUETDPS,
175173
{},
176174
)
@@ -194,7 +192,7 @@ async def test_send_decoded_command_publishes_message(mock_mqtt_channel: FakeCha
194192
mock_mqtt_channel.response_queue.append(response)
195193

196194
await send_decoded_command(
197-
mock_mqtt_channel,
195+
mock_mqtt_channel, # type: ignore[arg-type]
198196
B01_Q10_DP.REQUETDPS,
199197
{},
200198
)

tests/devices/traits/b01/q10/test_status.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Tests for B01 Q10 status trait."""
22

33
from typing import Any
4-
from unittest.mock import AsyncMock, patch
4+
from unittest.mock import patch
55

66
import pytest
77

@@ -15,7 +15,6 @@
1515
)
1616
from roborock.devices.traits.b01.q10 import Q10PropertiesApi
1717
from roborock.devices.traits.b01.q10.status import StatusTrait
18-
from roborock.roborock_message import RoborockMessage
1918
from tests.fixtures.channel_fixtures import FakeChannel
2019

2120

@@ -77,9 +76,9 @@ async def test_status_properties(
7776
assert status_trait.state_code == 2
7877
assert status_trait.state == YXDeviceState.SLEEP_STATE
7978
assert status_trait.battery == 91
80-
assert status_trait.fan_level == YXFanLevel.CUSTOM
81-
assert status_trait.water_level == YXWaterLevel.MEDIUM
82-
assert status_trait.clean_mode == YXDeviceWorkMode.STANDARD
79+
assert status_trait.fan_level == YXFanLevel.CUSTOM # type: ignore[attr-defined]
80+
assert status_trait.water_level == YXWaterLevel.MEDIUM # type: ignore[attr-defined]
81+
assert status_trait.clean_mode == YXDeviceWorkMode.STANDARD # type: ignore[attr-defined]
8382
assert status_trait.clean_task == YXDeviceCleanTask.UNKNOWN
8483
assert status_trait.cleaning_progress == 75
8584

@@ -106,17 +105,17 @@ async def test_status_enum_mappings(
106105
(B01_Q10_DP.STATUS, 2, YXDeviceState.SLEEP_STATE, "state"),
107106
(B01_Q10_DP.STATUS, 3, YXDeviceState.STANDBY_STATE, "state"),
108107
(B01_Q10_DP.STATUS, 5, YXDeviceState.CLEANING_STATE, "state"),
109-
(B01_Q10_DP.FUN_LEVEL, 1, YXFanLevel.QUIET, "fan_level"),
108+
(B01_Q10_DP.FUN_LEVEL, 1, YXFanLevel.QUIET, "fan_level"), # type: ignore[attr-defined]
110109
(B01_Q10_DP.FUN_LEVEL, 2, YXFanLevel.NORMAL, "fan_level"),
111110
(B01_Q10_DP.FUN_LEVEL, 3, YXFanLevel.STRONG, "fan_level"),
112111
(B01_Q10_DP.FUN_LEVEL, 4, YXFanLevel.MAX, "fan_level"),
113-
(B01_Q10_DP.FUN_LEVEL, 8, YXFanLevel.CUSTOM, "fan_level"),
112+
(B01_Q10_DP.FUN_LEVEL, 8, YXFanLevel.CUSTOM, "fan_level"), # type: ignore[attr-defined]
114113
(B01_Q10_DP.WATER_LEVEL, 0, YXWaterLevel.LOW, "water_level"),
115-
(B01_Q10_DP.WATER_LEVEL, 1, YXWaterLevel.MEDIUM, "water_level"),
114+
(B01_Q10_DP.WATER_LEVEL, 1, YXWaterLevel.MEDIUM, "water_level"), # type: ignore[attr-defined]
116115
(B01_Q10_DP.WATER_LEVEL, 2, YXWaterLevel.HIGH, "water_level"),
117-
(B01_Q10_DP.CLEAN_MODE, 1, YXDeviceWorkMode.QUIET, "clean_mode"),
118-
(B01_Q10_DP.CLEAN_MODE, 2, YXDeviceWorkMode.STANDARD, "clean_mode"),
119-
(B01_Q10_DP.CLEAN_MODE, 3, YXDeviceWorkMode.HIGH, "clean_mode"),
116+
(B01_Q10_DP.CLEAN_MODE, 1, YXDeviceWorkMode.QUIET, "clean_mode"), # type: ignore[attr-defined]
117+
(B01_Q10_DP.CLEAN_MODE, 2, YXDeviceWorkMode.STANDARD, "clean_mode"), # type: ignore[attr-defined]
118+
(B01_Q10_DP.CLEAN_MODE, 3, YXDeviceWorkMode.HIGH, "clean_mode"), # type: ignore[attr-defined]
120119
]
121120

122121
for dp, code, expected_enum, property_name in test_cases:

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)