mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Enable Ruff RUF013 (#115333)
This commit is contained in:
parent
7e1a5b19c4
commit
3efee10b95
@ -644,6 +644,7 @@ select = [
|
|||||||
"RSE", # flake8-raise
|
"RSE", # flake8-raise
|
||||||
"RUF005", # Consider iterable unpacking instead of concatenation
|
"RUF005", # Consider iterable unpacking instead of concatenation
|
||||||
"RUF006", # Store a reference to the return value of asyncio.create_task
|
"RUF006", # Store a reference to the return value of asyncio.create_task
|
||||||
|
"RUF013", # PEP 484 prohibits implicit Optional
|
||||||
# "RUF100", # Unused `noqa` directive; temporarily every now and then to clean them up
|
# "RUF100", # Unused `noqa` directive; temporarily every now and then to clean them up
|
||||||
"S102", # Use of exec detected
|
"S102", # Use of exec detected
|
||||||
"S103", # bad-file-permissions
|
"S103", # bad-file-permissions
|
||||||
|
@ -189,7 +189,9 @@ class Client:
|
|||||||
self.client = client
|
self.client = client
|
||||||
self.id = 0
|
self.id = 0
|
||||||
|
|
||||||
async def cmd(self, cmd: str, payload: dict[str, Any] = None) -> dict[str, Any]:
|
async def cmd(
|
||||||
|
self, cmd: str, payload: dict[str, Any] | None = None
|
||||||
|
) -> dict[str, Any]:
|
||||||
"""Send a command and receive the json result."""
|
"""Send a command and receive the json result."""
|
||||||
self.id += 1
|
self.id += 1
|
||||||
await self.client.send_json(
|
await self.client.send_json(
|
||||||
@ -203,7 +205,7 @@ class Client:
|
|||||||
assert resp.get("id") == self.id
|
assert resp.get("id") == self.id
|
||||||
return resp
|
return resp
|
||||||
|
|
||||||
async def cmd_result(self, cmd: str, payload: dict[str, Any] = None) -> Any:
|
async def cmd_result(self, cmd: str, payload: dict[str, Any] | None = None) -> Any:
|
||||||
"""Send a command and parse the result."""
|
"""Send a command and parse the result."""
|
||||||
resp = await self.cmd(cmd, payload)
|
resp = await self.cmd(cmd, payload)
|
||||||
assert resp.get("success")
|
assert resp.get("success")
|
||||||
|
@ -54,9 +54,9 @@ async def setup_mocked_integration(hass: HomeAssistant) -> MockConfigEntry:
|
|||||||
|
|
||||||
def check_remote_service_call(
|
def check_remote_service_call(
|
||||||
router: respx.MockRouter,
|
router: respx.MockRouter,
|
||||||
remote_service: str = None,
|
remote_service: str | None = None,
|
||||||
remote_service_params: dict = None,
|
remote_service_params: dict | None = None,
|
||||||
remote_service_payload: dict = None,
|
remote_service_payload: dict | None = None,
|
||||||
):
|
):
|
||||||
"""Check if the last call was a successful remote service call."""
|
"""Check if the last call was a successful remote service call."""
|
||||||
|
|
||||||
|
@ -83,11 +83,11 @@ async def setup_platform(
|
|||||||
discovered_device: dict[str, Any],
|
discovered_device: dict[str, Any],
|
||||||
*,
|
*,
|
||||||
bond_device_id: str = "bond-device-id",
|
bond_device_id: str = "bond-device-id",
|
||||||
bond_version: dict[str, Any] = None,
|
bond_version: dict[str, Any] | None = None,
|
||||||
props: dict[str, Any] = None,
|
props: dict[str, Any] | None = None,
|
||||||
state: dict[str, Any] = None,
|
state: dict[str, Any] | None = None,
|
||||||
bridge: dict[str, Any] = None,
|
bridge: dict[str, Any] | None = None,
|
||||||
token: dict[str, Any] = None,
|
token: dict[str, Any] | None = None,
|
||||||
):
|
):
|
||||||
"""Set up the specified Bond platform."""
|
"""Set up the specified Bond platform."""
|
||||||
mock_entry = MockConfigEntry(
|
mock_entry = MockConfigEntry(
|
||||||
|
@ -7,7 +7,7 @@ from unittest.mock import MagicMock, patch
|
|||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
def mock_asyncio_subprocess_run(
|
def mock_asyncio_subprocess_run(
|
||||||
response: bytes = b"", returncode: int = 0, exception: Exception = None
|
response: bytes = b"", returncode: int = 0, exception: Exception | None = None
|
||||||
):
|
):
|
||||||
"""Mock create_subprocess_shell."""
|
"""Mock create_subprocess_shell."""
|
||||||
|
|
||||||
|
@ -30,14 +30,14 @@ from tests.common import MockPlatform, mock_platform
|
|||||||
@bind_hass
|
@bind_hass
|
||||||
def async_see(
|
def async_see(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
mac: str = None,
|
mac: str | None = None,
|
||||||
dev_id: str = None,
|
dev_id: str | None = None,
|
||||||
host_name: str = None,
|
host_name: str | None = None,
|
||||||
location_name: str = None,
|
location_name: str | None = None,
|
||||||
gps: GPSType = None,
|
gps: GPSType | None = None,
|
||||||
gps_accuracy=None,
|
gps_accuracy=None,
|
||||||
battery: int = None,
|
battery: int | None = None,
|
||||||
attributes: dict = None,
|
attributes: dict | None = None,
|
||||||
):
|
):
|
||||||
"""Call service to notify you see device."""
|
"""Call service to notify you see device."""
|
||||||
data = {
|
data = {
|
||||||
|
@ -29,7 +29,7 @@ def discord_aiohttp_mock_factory(
|
|||||||
"""Create Discord service mock from factory."""
|
"""Create Discord service mock from factory."""
|
||||||
|
|
||||||
def _discord_aiohttp_mock_factory(
|
def _discord_aiohttp_mock_factory(
|
||||||
headers: dict[str, str] = None,
|
headers: dict[str, str] | None = None,
|
||||||
) -> AiohttpClientMocker:
|
) -> AiohttpClientMocker:
|
||||||
if headers is not None:
|
if headers is not None:
|
||||||
aioclient_mock.get(
|
aioclient_mock.get(
|
||||||
|
@ -32,8 +32,8 @@ from tests.common import MockEntity
|
|||||||
async def async_turn_on(
|
async def async_turn_on(
|
||||||
hass,
|
hass,
|
||||||
entity_id=ENTITY_MATCH_ALL,
|
entity_id=ENTITY_MATCH_ALL,
|
||||||
percentage: int = None,
|
percentage: int | None = None,
|
||||||
preset_mode: str = None,
|
preset_mode: str | None = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Turn all or specified fan on."""
|
"""Turn all or specified fan on."""
|
||||||
data = {
|
data = {
|
||||||
@ -76,7 +76,7 @@ async def async_oscillate(
|
|||||||
|
|
||||||
|
|
||||||
async def async_set_preset_mode(
|
async def async_set_preset_mode(
|
||||||
hass, entity_id=ENTITY_MATCH_ALL, preset_mode: str = None
|
hass, entity_id=ENTITY_MATCH_ALL, preset_mode: str | None = None
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set preset mode for all or specified fan."""
|
"""Set preset mode for all or specified fan."""
|
||||||
data = {
|
data = {
|
||||||
@ -90,7 +90,7 @@ async def async_set_preset_mode(
|
|||||||
|
|
||||||
|
|
||||||
async def async_set_percentage(
|
async def async_set_percentage(
|
||||||
hass, entity_id=ENTITY_MATCH_ALL, percentage: int = None
|
hass, entity_id=ENTITY_MATCH_ALL, percentage: int | None = None
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set percentage for all or specified fan."""
|
"""Set percentage for all or specified fan."""
|
||||||
data = {
|
data = {
|
||||||
@ -104,7 +104,7 @@ async def async_set_percentage(
|
|||||||
|
|
||||||
|
|
||||||
async def async_increase_speed(
|
async def async_increase_speed(
|
||||||
hass, entity_id=ENTITY_MATCH_ALL, percentage_step: int = None
|
hass, entity_id=ENTITY_MATCH_ALL, percentage_step: int | None = None
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Increase speed for all or specified fan."""
|
"""Increase speed for all or specified fan."""
|
||||||
data = {
|
data = {
|
||||||
@ -121,7 +121,7 @@ async def async_increase_speed(
|
|||||||
|
|
||||||
|
|
||||||
async def async_decrease_speed(
|
async def async_decrease_speed(
|
||||||
hass, entity_id=ENTITY_MATCH_ALL, percentage_step: int = None
|
hass, entity_id=ENTITY_MATCH_ALL, percentage_step: int | None = None
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Decrease speed for all or specified fan."""
|
"""Decrease speed for all or specified fan."""
|
||||||
data = {
|
data = {
|
||||||
@ -138,7 +138,7 @@ async def async_decrease_speed(
|
|||||||
|
|
||||||
|
|
||||||
async def async_set_direction(
|
async def async_set_direction(
|
||||||
hass, entity_id=ENTITY_MATCH_ALL, direction: str = None
|
hass, entity_id=ENTITY_MATCH_ALL, direction: str | None = None
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set direction for all or specified fan."""
|
"""Set direction for all or specified fan."""
|
||||||
data = {
|
data = {
|
||||||
|
@ -23,9 +23,9 @@ async def setup_config_entry(
|
|||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
data: dict[str, Any],
|
data: dict[str, Any],
|
||||||
unique_id: str = "any",
|
unique_id: str = "any",
|
||||||
device: Mock = None,
|
device: Mock | None = None,
|
||||||
fritz: Mock = None,
|
fritz: Mock | None = None,
|
||||||
template: Mock = None,
|
template: Mock | None = None,
|
||||||
) -> bool:
|
) -> bool:
|
||||||
"""Do setup of a MockConfigEntry."""
|
"""Do setup of a MockConfigEntry."""
|
||||||
entry = MockConfigEntry(
|
entry = MockConfigEntry(
|
||||||
|
@ -241,7 +241,7 @@ def mock_events_list(
|
|||||||
|
|
||||||
def _put_result(
|
def _put_result(
|
||||||
response: dict[str, Any],
|
response: dict[str, Any],
|
||||||
calendar_id: str = None,
|
calendar_id: str | None = None,
|
||||||
exc: ClientError | None = None,
|
exc: ClientError | None = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
if calendar_id is None:
|
if calendar_id is None:
|
||||||
|
@ -79,7 +79,9 @@ class Client:
|
|||||||
self.client = client
|
self.client = client
|
||||||
self.id = 0
|
self.id = 0
|
||||||
|
|
||||||
async def cmd(self, cmd: str, payload: dict[str, Any] = None) -> dict[str, Any]:
|
async def cmd(
|
||||||
|
self, cmd: str, payload: dict[str, Any] | None = None
|
||||||
|
) -> dict[str, Any]:
|
||||||
"""Send a command and receive the json result."""
|
"""Send a command and receive the json result."""
|
||||||
self.id += 1
|
self.id += 1
|
||||||
await self.client.send_json(
|
await self.client.send_json(
|
||||||
@ -93,7 +95,7 @@ class Client:
|
|||||||
assert resp.get("id") == self.id
|
assert resp.get("id") == self.id
|
||||||
return resp
|
return resp
|
||||||
|
|
||||||
async def cmd_result(self, cmd: str, payload: dict[str, Any] = None) -> Any:
|
async def cmd_result(self, cmd: str, payload: dict[str, Any] | None = None) -> Any:
|
||||||
"""Send a command and parse the result."""
|
"""Send a command and parse the result."""
|
||||||
resp = await self.cmd(cmd, payload)
|
resp = await self.cmd(cmd, payload)
|
||||||
assert resp.get("success")
|
assert resp.get("success")
|
||||||
|
@ -101,7 +101,7 @@ async def async_turn_off(hass: HomeAssistant, entity_id=ENTITY_MATCH_ALL) -> Non
|
|||||||
|
|
||||||
|
|
||||||
async def async_set_mode(
|
async def async_set_mode(
|
||||||
hass: HomeAssistant, entity_id=ENTITY_MATCH_ALL, mode: str = None
|
hass: HomeAssistant, entity_id=ENTITY_MATCH_ALL, mode: str | None = None
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set mode for all or specified humidifier."""
|
"""Set mode for all or specified humidifier."""
|
||||||
data = {
|
data = {
|
||||||
@ -114,7 +114,7 @@ async def async_set_mode(
|
|||||||
|
|
||||||
|
|
||||||
async def async_set_humidity(
|
async def async_set_humidity(
|
||||||
hass: HomeAssistant, entity_id=ENTITY_MATCH_ALL, humidity: int = None
|
hass: HomeAssistant, entity_id=ENTITY_MATCH_ALL, humidity: int | None = None
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set target humidity for all or specified humidifier."""
|
"""Set target humidity for all or specified humidifier."""
|
||||||
data = {
|
data = {
|
||||||
|
@ -148,7 +148,9 @@ class CreateDevice:
|
|||||||
self.data = {"traits": {}}
|
self.data = {"traits": {}}
|
||||||
|
|
||||||
def create(
|
def create(
|
||||||
self, raw_traits: dict[str, Any] = None, raw_data: dict[str, Any] = None
|
self,
|
||||||
|
raw_traits: dict[str, Any] | None = None,
|
||||||
|
raw_data: dict[str, Any] | None = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Create a new device with the specifeid traits."""
|
"""Create a new device with the specifeid traits."""
|
||||||
data = copy.deepcopy(self.data)
|
data = copy.deepcopy(self.data)
|
||||||
|
@ -104,7 +104,7 @@ def webrtc_camera_device(create_device: CreateDevice) -> None:
|
|||||||
def make_motion_event(
|
def make_motion_event(
|
||||||
event_id: str = MOTION_EVENT_ID,
|
event_id: str = MOTION_EVENT_ID,
|
||||||
event_session_id: str = EVENT_SESSION_ID,
|
event_session_id: str = EVENT_SESSION_ID,
|
||||||
timestamp: datetime.datetime = None,
|
timestamp: datetime.datetime | None = None,
|
||||||
) -> EventMessage:
|
) -> EventMessage:
|
||||||
"""Create an EventMessage for a motion event."""
|
"""Create an EventMessage for a motion event."""
|
||||||
if not timestamp:
|
if not timestamp:
|
||||||
@ -128,7 +128,7 @@ def make_motion_event(
|
|||||||
|
|
||||||
|
|
||||||
def make_stream_url_response(
|
def make_stream_url_response(
|
||||||
expiration: datetime.datetime = None, token_num: int = 0
|
expiration: datetime.datetime | None = None, token_num: int = 0
|
||||||
) -> aiohttp.web.Response:
|
) -> aiohttp.web.Response:
|
||||||
"""Make response for the API that generates a streaming url."""
|
"""Make response for the API that generates a streaming url."""
|
||||||
if not expiration:
|
if not expiration:
|
||||||
|
@ -152,7 +152,7 @@ class OAuthFixture:
|
|||||||
)
|
)
|
||||||
|
|
||||||
async def async_finish_setup(
|
async def async_finish_setup(
|
||||||
self, result: dict, user_input: dict = None
|
self, result: dict, user_input: dict | None = None
|
||||||
) -> ConfigEntry:
|
) -> ConfigEntry:
|
||||||
"""Finish the OAuth flow exchanging auth token for refresh token."""
|
"""Finish the OAuth flow exchanging auth token for refresh token."""
|
||||||
with patch(
|
with patch(
|
||||||
|
@ -33,14 +33,14 @@ def _get_mock_nutclient(
|
|||||||
|
|
||||||
async def async_init_integration(
|
async def async_init_integration(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
ups_fixture: str = None,
|
ups_fixture: str | None = None,
|
||||||
username: str = "mock",
|
username: str = "mock",
|
||||||
password: str = "mock",
|
password: str = "mock",
|
||||||
list_ups: dict[str, str] = None,
|
list_ups: dict[str, str] | None = None,
|
||||||
list_vars: dict[str, str] = None,
|
list_vars: dict[str, str] | None = None,
|
||||||
list_commands_return_value: dict[str, str] = None,
|
list_commands_return_value: dict[str, str] | None = None,
|
||||||
list_commands_side_effect=None,
|
list_commands_side_effect=None,
|
||||||
run_command: MagicMock = None,
|
run_command: MagicMock | None = None,
|
||||||
) -> MockConfigEntry:
|
) -> MockConfigEntry:
|
||||||
"""Set up the nut integration in Home Assistant."""
|
"""Set up the nut integration in Home Assistant."""
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ async def setup_integration(
|
|||||||
aioclient_mock: AiohttpClientMocker,
|
aioclient_mock: AiohttpClientMocker,
|
||||||
url: str = URL,
|
url: str = URL,
|
||||||
api_key: str = API_KEY,
|
api_key: str = API_KEY,
|
||||||
unique_id: str = None,
|
unique_id: str | None = None,
|
||||||
skip_entry_setup: bool = False,
|
skip_entry_setup: bool = False,
|
||||||
connection_error: bool = False,
|
connection_error: bool = False,
|
||||||
invalid_auth: bool = False,
|
invalid_auth: bool = False,
|
||||||
|
@ -109,7 +109,7 @@ async def async_wait_recording_done(hass: HomeAssistant) -> None:
|
|||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
|
|
||||||
async def async_wait_purge_done(hass: HomeAssistant, max: int = None) -> None:
|
async def async_wait_purge_done(hass: HomeAssistant, max: int | None = None) -> None:
|
||||||
"""Wait for max number of purge events.
|
"""Wait for max number of purge events.
|
||||||
|
|
||||||
Because a purge may insert another PurgeTask into
|
Because a purge may insert another PurgeTask into
|
||||||
|
@ -111,7 +111,7 @@ class RuckusAjaxApiPatchContext:
|
|||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
login_mock: AsyncMock = None,
|
login_mock: AsyncMock | None = None,
|
||||||
system_info: dict | None = None,
|
system_info: dict | None = None,
|
||||||
mesh_info: dict | None = None,
|
mesh_info: dict | None = None,
|
||||||
active_clients: list[dict] | AsyncMock | None = None,
|
active_clients: list[dict] | AsyncMock | None = None,
|
||||||
|
@ -61,7 +61,7 @@ async def stub_async_connect(
|
|||||||
gtype=None,
|
gtype=None,
|
||||||
gsubtype=None,
|
gsubtype=None,
|
||||||
name=MOCK_ADAPTER_NAME,
|
name=MOCK_ADAPTER_NAME,
|
||||||
connection_closed_callback: Callable = None,
|
connection_closed_callback: Callable | None = None,
|
||||||
) -> bool:
|
) -> bool:
|
||||||
"""Initialize minimum attributes needed for tests."""
|
"""Initialize minimum attributes needed for tests."""
|
||||||
self._ip = ip
|
self._ip = ip
|
||||||
|
@ -32,7 +32,7 @@ def signal_requests_mock_factory(requests_mock: Mocker) -> Mocker:
|
|||||||
"""Create signal service mock from factory."""
|
"""Create signal service mock from factory."""
|
||||||
|
|
||||||
def _signal_requests_mock_factory(
|
def _signal_requests_mock_factory(
|
||||||
success_send_result: bool = True, content_length_header: str = None
|
success_send_result: bool = True, content_length_header: str | None = None
|
||||||
) -> Mocker:
|
) -> Mocker:
|
||||||
requests_mock.register_uri(
|
requests_mock.register_uri(
|
||||||
"GET",
|
"GET",
|
||||||
|
@ -253,7 +253,7 @@ def device_factory_fixture():
|
|||||||
api = Mock(Api)
|
api = Mock(Api)
|
||||||
api.post_device_command.return_value = {"results": [{"status": "ACCEPTED"}]}
|
api.post_device_command.return_value = {"results": [{"status": "ACCEPTED"}]}
|
||||||
|
|
||||||
def _factory(label, capabilities, status: dict = None):
|
def _factory(label, capabilities, status: dict | None = None):
|
||||||
device_data = {
|
device_data = {
|
||||||
"deviceId": str(uuid4()),
|
"deviceId": str(uuid4()),
|
||||||
"name": "Device Type Handler Name",
|
"name": "Device Type Handler Name",
|
||||||
|
@ -262,7 +262,7 @@ YAML_CONFIG_ALL_TEMPLATES = {
|
|||||||
|
|
||||||
async def init_integration(
|
async def init_integration(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
config: dict[str, Any] = None,
|
config: dict[str, Any] | None = None,
|
||||||
entry_id: str = "1",
|
entry_id: str = "1",
|
||||||
source: str = SOURCE_USER,
|
source: str = SOURCE_USER,
|
||||||
) -> MockConfigEntry:
|
) -> MockConfigEntry:
|
||||||
|
@ -72,7 +72,7 @@ async def setup_integration(
|
|||||||
aioclient_mock: AiohttpClientMocker,
|
aioclient_mock: AiohttpClientMocker,
|
||||||
url: str = URL,
|
url: str = URL,
|
||||||
api_key: str = API_KEY,
|
api_key: str = API_KEY,
|
||||||
unique_id: str = None,
|
unique_id: str | None = None,
|
||||||
skip_entry_setup: bool = False,
|
skip_entry_setup: bool = False,
|
||||||
invalid_auth: bool = False,
|
invalid_auth: bool = False,
|
||||||
) -> MockConfigEntry:
|
) -> MockConfigEntry:
|
||||||
|
@ -54,7 +54,7 @@ class MockValveEntity(ValveEntity):
|
|||||||
unique_id: str = "mock_valve",
|
unique_id: str = "mock_valve",
|
||||||
name: str = "Valve",
|
name: str = "Valve",
|
||||||
features: ValveEntityFeature = ValveEntityFeature(0),
|
features: ValveEntityFeature = ValveEntityFeature(0),
|
||||||
current_position: int = None,
|
current_position: int | None = None,
|
||||||
device_class: ValveDeviceClass = None,
|
device_class: ValveDeviceClass = None,
|
||||||
reports_position: bool = True,
|
reports_position: bool = True,
|
||||||
) -> None:
|
) -> None:
|
||||||
@ -104,7 +104,7 @@ class MockBinaryValveEntity(ValveEntity):
|
|||||||
unique_id: str = "mock_valve_2",
|
unique_id: str = "mock_valve_2",
|
||||||
name: str = "Valve",
|
name: str = "Valve",
|
||||||
features: ValveEntityFeature = ValveEntityFeature(0),
|
features: ValveEntityFeature = ValveEntityFeature(0),
|
||||||
is_closed: bool = None,
|
is_closed: bool | None = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialize the valve."""
|
"""Initialize the valve."""
|
||||||
self._attr_name = name
|
self._attr_name = name
|
||||||
|
@ -58,8 +58,8 @@ class ControllerConfig(NamedTuple):
|
|||||||
|
|
||||||
|
|
||||||
def new_simple_controller_config(
|
def new_simple_controller_config(
|
||||||
config: dict = None,
|
config: dict | None = None,
|
||||||
options: dict = None,
|
options: dict | None = None,
|
||||||
config_source=ConfigSource.CONFIG_FLOW,
|
config_source=ConfigSource.CONFIG_FLOW,
|
||||||
serial_number="1111",
|
serial_number="1111",
|
||||||
devices: tuple[pv.VeraDevice, ...] = (),
|
devices: tuple[pv.VeraDevice, ...] = (),
|
||||||
|
@ -20,8 +20,8 @@ async def run_sensor_test(
|
|||||||
category: int,
|
category: int,
|
||||||
class_property: str,
|
class_property: str,
|
||||||
assert_states: tuple[tuple[Any, Any]],
|
assert_states: tuple[tuple[Any, Any]],
|
||||||
assert_unit_of_measurement: str = None,
|
assert_unit_of_measurement: str | None = None,
|
||||||
setup_callback: Callable[[pv.VeraController], None] = None,
|
setup_callback: Callable[[pv.VeraController], None] | None = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test generic sensor."""
|
"""Test generic sensor."""
|
||||||
vera_device: pv.VeraSensor = MagicMock(spec=pv.VeraSensor)
|
vera_device: pv.VeraSensor = MagicMock(spec=pv.VeraSensor)
|
||||||
|
@ -43,7 +43,7 @@ async def mock_get_version_update(
|
|||||||
freezer: FrozenDateTimeFactory,
|
freezer: FrozenDateTimeFactory,
|
||||||
version: str = MOCK_VERSION,
|
version: str = MOCK_VERSION,
|
||||||
data: dict[str, Any] = MOCK_VERSION_DATA,
|
data: dict[str, Any] = MOCK_VERSION_DATA,
|
||||||
side_effect: Exception = None,
|
side_effect: Exception | None = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Mock getting version."""
|
"""Mock getting version."""
|
||||||
with patch(
|
with patch(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user