Add missing return type in test __init__ methods (#123932)

* Add missing return type in test __init__ methods

* Adjust
This commit is contained in:
epenet 2024-08-14 16:48:52 +02:00 committed by GitHub
parent faacfe3f90
commit 5608301178
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
35 changed files with 64 additions and 47 deletions

View File

@ -1,5 +1,6 @@
"""Define patches used for androidtv tests.""" """Define patches used for androidtv tests."""
from typing import Any
from unittest.mock import patch from unittest.mock import patch
from androidtv.adb_manager.adb_manager_async import DeviceAsync from androidtv.adb_manager.adb_manager_async import DeviceAsync
@ -25,7 +26,7 @@ PROPS_DEV_MAC = "ether ab:cd:ef:gh:ij:kl brd"
class AdbDeviceTcpAsyncFake: class AdbDeviceTcpAsyncFake:
"""A fake of the `adb_shell.adb_device_async.AdbDeviceTcpAsync` class.""" """A fake of the `adb_shell.adb_device_async.AdbDeviceTcpAsync` class."""
def __init__(self, *args, **kwargs) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None:
"""Initialize a fake `adb_shell.adb_device_async.AdbDeviceTcpAsync` instance.""" """Initialize a fake `adb_shell.adb_device_async.AdbDeviceTcpAsync` instance."""
self.available = False self.available = False

View File

@ -1,5 +1,7 @@
"""Test code shared between test files.""" """Test code shared between test files."""
from typing import Any
from pyatv import conf, const, interface from pyatv import conf, const, interface
from pyatv.const import Protocol from pyatv.const import Protocol
@ -7,7 +9,7 @@ from pyatv.const import Protocol
class MockPairingHandler(interface.PairingHandler): class MockPairingHandler(interface.PairingHandler):
"""Mock for PairingHandler in pyatv.""" """Mock for PairingHandler in pyatv."""
def __init__(self, *args): def __init__(self, *args: Any) -> None:
"""Initialize a new MockPairingHandler.""" """Initialize a new MockPairingHandler."""
super().__init__(*args) super().__init__(*args)
self.pin_code = None self.pin_code = None

View File

@ -1,6 +1,7 @@
"""Tests for the aws component config and setup.""" """Tests for the aws component config and setup."""
import json import json
from typing import Any
from unittest.mock import AsyncMock, MagicMock, call, patch as async_patch from unittest.mock import AsyncMock, MagicMock, call, patch as async_patch
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
@ -10,7 +11,7 @@ from homeassistant.setup import async_setup_component
class MockAioSession: class MockAioSession:
"""Mock AioSession.""" """Mock AioSession."""
def __init__(self, *args, **kwargs): def __init__(self, *args: Any, **kwargs: Any) -> None:
"""Init a mock session.""" """Init a mock session."""
self.get_user = AsyncMock() self.get_user = AsyncMock()
self.invoke = AsyncMock() self.invoke = AsyncMock()

View File

@ -35,7 +35,7 @@ class AttrDict(dict):
class MockBlackbird: class MockBlackbird:
"""Mock for pyblackbird object.""" """Mock for pyblackbird object."""
def __init__(self): def __init__(self) -> None:
"""Init mock object.""" """Init mock object."""
self.zones = defaultdict(lambda: AttrDict(power=True, av=1)) self.zones = defaultdict(lambda: AttrDict(power=True, av=1))

View File

@ -271,7 +271,7 @@ async def _async_setup_with_adapter(
class MockBleakClient(BleakClient): class MockBleakClient(BleakClient):
"""Mock bleak client.""" """Mock bleak client."""
def __init__(self, *args, **kwargs): def __init__(self, *args: Any, **kwargs: Any) -> None:
"""Mock init.""" """Mock init."""
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
self._device_path = "/dev/test" self._device_path = "/dev/test"

View File

@ -3,6 +3,7 @@
import asyncio import asyncio
from datetime import timedelta from datetime import timedelta
import time import time
from typing import Any
from unittest.mock import ANY, AsyncMock, MagicMock, Mock, patch from unittest.mock import ANY, AsyncMock, MagicMock, Mock, patch
from bleak import BleakError from bleak import BleakError
@ -100,7 +101,7 @@ async def test_setup_and_stop_passive(
init_kwargs = None init_kwargs = None
class MockPassiveBleakScanner: class MockPassiveBleakScanner:
def __init__(self, *args, **kwargs): def __init__(self, *args: Any, **kwargs: Any) -> None:
"""Init the scanner.""" """Init the scanner."""
nonlocal init_kwargs nonlocal init_kwargs
init_kwargs = kwargs init_kwargs = kwargs
@ -151,7 +152,7 @@ async def test_setup_and_stop_old_bluez(
init_kwargs = None init_kwargs = None
class MockBleakScanner: class MockBleakScanner:
def __init__(self, *args, **kwargs): def __init__(self, *args: Any, **kwargs: Any) -> None:
"""Init the scanner.""" """Init the scanner."""
nonlocal init_kwargs nonlocal init_kwargs
init_kwargs = kwargs init_kwargs = kwargs

View File

@ -3,6 +3,7 @@
import asyncio import asyncio
from datetime import timedelta from datetime import timedelta
import time import time
from typing import Any
from unittest.mock import ANY, MagicMock, patch from unittest.mock import ANY, MagicMock, patch
from bleak import BleakError from bleak import BleakError
@ -631,7 +632,7 @@ async def test_setup_and_stop_macos(
init_kwargs = None init_kwargs = None
class MockBleakScanner: class MockBleakScanner:
def __init__(self, *args, **kwargs): def __init__(self, *args: Any, **kwargs: Any) -> None:
"""Init the scanner.""" """Init the scanner."""
nonlocal init_kwargs nonlocal init_kwargs
init_kwargs = kwargs init_kwargs = kwargs

View File

@ -1,6 +1,7 @@
"""Test Bluetooth LE device tracker.""" """Test Bluetooth LE device tracker."""
from datetime import timedelta from datetime import timedelta
from typing import Any
from unittest.mock import patch from unittest.mock import patch
from bleak import BleakError from bleak import BleakError
@ -31,7 +32,7 @@ from tests.components.bluetooth import generate_advertisement_data, generate_ble
class MockBleakClient: class MockBleakClient:
"""Mock BleakClient.""" """Mock BleakClient."""
def __init__(self, *args, **kwargs): def __init__(self, *args: Any, **kwargs: Any) -> None:
"""Mock BleakClient.""" """Mock BleakClient."""
async def __aenter__(self, *args, **kwargs): async def __aenter__(self, *args, **kwargs):

View File

@ -497,7 +497,7 @@ async def test_media_image_proxy(
class MockResponse: class MockResponse:
"""Test response.""" """Test response."""
def __init__(self): def __init__(self) -> None:
"""Test response init.""" """Test response init."""
self.status = 200 self.status = 200
self.headers = {"Content-Type": "sometype"} self.headers = {"Content-Type": "sometype"}

View File

@ -61,7 +61,7 @@ def async_see(
class MockScannerEntity(ScannerEntity): class MockScannerEntity(ScannerEntity):
"""Test implementation of a ScannerEntity.""" """Test implementation of a ScannerEntity."""
def __init__(self): def __init__(self) -> None:
"""Init.""" """Init."""
self.connected = False self.connected = False
self._hostname = "test.hostname.org" self._hostname = "test.hostname.org"
@ -110,7 +110,7 @@ class MockScannerEntity(ScannerEntity):
class MockScanner(DeviceScanner): class MockScanner(DeviceScanner):
"""Mock device scanner.""" """Mock device scanner."""
def __init__(self): def __init__(self) -> None:
"""Initialize the MockScanner.""" """Initialize the MockScanner."""
self.devices_home = [] self.devices_home = []

View File

@ -421,7 +421,7 @@ async def _mock_generic_device_entry(
class MockReconnectLogic(BaseMockReconnectLogic): class MockReconnectLogic(BaseMockReconnectLogic):
"""Mock ReconnectLogic.""" """Mock ReconnectLogic."""
def __init__(self, *args, **kwargs): def __init__(self, *args: Any, **kwargs: Any) -> None:
"""Init the mock.""" """Init the mock."""
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
mock_device.set_on_disconnect(kwargs["on_disconnect"]) mock_device.set_on_disconnect(kwargs["on_disconnect"])

View File

@ -38,7 +38,7 @@ from tests.common import (
class BaseFan(FanEntity): class BaseFan(FanEntity):
"""Implementation of the abstract FanEntity.""" """Implementation of the abstract FanEntity."""
def __init__(self): def __init__(self) -> None:
"""Initialize the fan.""" """Initialize the fan."""

View File

@ -3,6 +3,7 @@
from contextlib import contextmanager from contextlib import contextmanager
from pathlib import Path from pathlib import Path
from random import getrandbits from random import getrandbits
from typing import Any
from unittest.mock import patch from unittest.mock import patch
import pytest import pytest
@ -141,7 +142,7 @@ async def test_upload_large_file_fails(
yield MockPathOpen() yield MockPathOpen()
class MockPathOpen: class MockPathOpen:
def __init__(self, *args, **kwargs) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None:
pass pass
def write(self, data: bytes) -> None: def write(self, data: bytes) -> None:

View File

@ -427,7 +427,7 @@ async def test_auth_create_token_approval_declined_task_canceled(
class CanceledAwaitableMock(AsyncMock): class CanceledAwaitableMock(AsyncMock):
"""A canceled awaitable mock.""" """A canceled awaitable mock."""
def __init__(self): def __init__(self) -> None:
super().__init__() super().__init__()
self.done = Mock(return_value=False) self.done = Mock(return_value=False)
self.cancel = Mock() self.cancel = Mock()

View File

@ -2,6 +2,7 @@
from collections.abc import AsyncGenerator from collections.abc import AsyncGenerator
import json import json
from typing import Any
from unittest.mock import AsyncMock, patch from unittest.mock import AsyncMock, patch
import pypck import pypck
@ -29,7 +30,7 @@ class MockModuleConnection(ModuleConnection):
request_name = AsyncMock(return_value="TestModule") request_name = AsyncMock(return_value="TestModule")
send_command = AsyncMock(return_value=True) send_command = AsyncMock(return_value=True)
def __init__(self, *args, **kwargs): def __init__(self, *args: Any, **kwargs: Any) -> None:
"""Construct ModuleConnection instance.""" """Construct ModuleConnection instance."""
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
self.serials_request_handler.serial_known.set() self.serials_request_handler.serial_known.set()

View File

@ -4,6 +4,7 @@ from __future__ import annotations
import asyncio import asyncio
from contextlib import contextmanager from contextlib import contextmanager
from typing import Any
from unittest.mock import AsyncMock, MagicMock, Mock, patch from unittest.mock import AsyncMock, MagicMock, Mock, patch
from aiolifx.aiolifx import Light from aiolifx.aiolifx import Light
@ -212,7 +213,7 @@ def _patch_device(device: Light | None = None, no_device: bool = False):
class MockLifxConnecton: class MockLifxConnecton:
"""Mock lifx discovery.""" """Mock lifx discovery."""
def __init__(self, *args, **kwargs): def __init__(self, *args: Any, **kwargs: Any) -> None:
"""Init connection.""" """Init connection."""
if no_device: if no_device:
self.device = _mocked_failing_bulb() self.device = _mocked_failing_bulb()
@ -240,7 +241,7 @@ def _patch_discovery(device: Light | None = None, no_device: bool = False):
class MockLifxDiscovery: class MockLifxDiscovery:
"""Mock lifx discovery.""" """Mock lifx discovery."""
def __init__(self, *args, **kwargs): def __init__(self, *args: Any, **kwargs: Any) -> None:
"""Init discovery.""" """Init discovery."""
if no_device: if no_device:
self.lights = {} self.lights = {}
@ -276,7 +277,7 @@ def _patch_config_flow_try_connect(
class MockLifxConnection: class MockLifxConnection:
"""Mock lifx discovery.""" """Mock lifx discovery."""
def __init__(self, *args, **kwargs): def __init__(self, *args: Any, **kwargs: Any) -> None:
"""Init connection.""" """Init connection."""
if no_device: if no_device:
self.device = _mocked_failing_bulb() self.device = _mocked_failing_bulb()

View File

@ -1,5 +1,6 @@
"""Tests for the lifx integration.""" """Tests for the lifx integration."""
from typing import Any
from unittest.mock import AsyncMock, MagicMock, patch from unittest.mock import AsyncMock, MagicMock, patch
import pytest import pytest
@ -21,7 +22,7 @@ def mock_effect_conductor():
"""Mock the effect conductor.""" """Mock the effect conductor."""
class MockConductor: class MockConductor:
def __init__(self, *args, **kwargs) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None:
"""Mock the conductor.""" """Mock the conductor."""
self.start = AsyncMock() self.start = AsyncMock()
self.stop = AsyncMock() self.stop = AsyncMock()

View File

@ -2,6 +2,7 @@
from ipaddress import ip_address from ipaddress import ip_address
import socket import socket
from typing import Any
from unittest.mock import patch from unittest.mock import patch
import pytest import pytest
@ -288,7 +289,7 @@ async def test_manual_dns_error(hass: HomeAssistant) -> None:
class MockLifxConnectonDnsError: class MockLifxConnectonDnsError:
"""Mock lifx discovery.""" """Mock lifx discovery."""
def __init__(self, *args, **kwargs): def __init__(self, *args: Any, **kwargs: Any) -> None:
"""Init connection.""" """Init connection."""
self.device = _mocked_failing_bulb() self.device = _mocked_failing_bulb()

View File

@ -4,6 +4,7 @@ from __future__ import annotations
from datetime import timedelta from datetime import timedelta
import socket import socket
from typing import Any
from unittest.mock import patch from unittest.mock import patch
import pytest import pytest
@ -37,7 +38,7 @@ async def test_configuring_lifx_causes_discovery(hass: HomeAssistant) -> None:
class MockLifxDiscovery: class MockLifxDiscovery:
"""Mock lifx discovery.""" """Mock lifx discovery."""
def __init__(self, *args, **kwargs): def __init__(self, *args: Any, **kwargs: Any) -> None:
"""Init discovery.""" """Init discovery."""
discovered = _mocked_bulb() discovered = _mocked_bulb()
self.lights = {discovered.mac_addr: discovered} self.lights = {discovered.mac_addr: discovered}
@ -137,7 +138,7 @@ async def test_dns_error_at_startup(hass: HomeAssistant) -> None:
class MockLifxConnectonDnsError: class MockLifxConnectonDnsError:
"""Mock lifx connection with a dns error.""" """Mock lifx connection with a dns error."""
def __init__(self, *args, **kwargs): def __init__(self, *args: Any, **kwargs: Any) -> None:
"""Init connection.""" """Init connection."""
self.device = bulb self.device = bulb

View File

@ -3,6 +3,7 @@
from __future__ import annotations from __future__ import annotations
from datetime import timedelta from datetime import timedelta
from typing import Any
from unittest.mock import patch from unittest.mock import patch
from homeassistant import setup from homeassistant import setup
@ -114,7 +115,7 @@ async def test_discovery_is_more_frequent_during_migration(
class MockLifxDiscovery: class MockLifxDiscovery:
"""Mock lifx discovery.""" """Mock lifx discovery."""
def __init__(self, *args, **kwargs): def __init__(self, *args: Any, **kwargs: Any) -> None:
"""Init discovery.""" """Init discovery."""
self.bulb = bulb self.bulb = bulb
self.lights = {} self.lights = {}

View File

@ -58,7 +58,7 @@ class AttrDict(dict):
class MockMonoprice: class MockMonoprice:
"""Mock for pymonoprice object.""" """Mock for pymonoprice object."""
def __init__(self): def __init__(self) -> None:
"""Init mock object.""" """Init mock object."""
self.zones = defaultdict( self.zones = defaultdict(
lambda: AttrDict(power=True, volume=0, mute=True, source=1) lambda: AttrDict(power=True, volume=0, mute=True, source=1)

View File

@ -92,7 +92,7 @@ class FakeSubscriber(GoogleNestSubscriber):
stop_calls = 0 stop_calls = 0
def __init__(self): # pylint: disable=super-init-not-called def __init__(self) -> None: # pylint: disable=super-init-not-called
"""Initialize Fake Subscriber.""" """Initialize Fake Subscriber."""
self._device_manager = DeviceManager() self._device_manager = DeviceManager()

View File

@ -53,7 +53,7 @@ class FakeAuth(AbstractAuth):
from the API. from the API.
""" """
def __init__(self): def __init__(self) -> None:
"""Initialize FakeAuth.""" """Initialize FakeAuth."""
super().__init__(None, None) super().__init__(None, None)
# Tests can set fake responses here. # Tests can set fake responses here.

View File

@ -8,7 +8,7 @@ class NumatoModuleMock:
NumatoGpioError = NumatoGpioError NumatoGpioError = NumatoGpioError
def __init__(self): def __init__(self) -> None:
"""Initialize the numato_gpio module mockup class.""" """Initialize the numato_gpio module mockup class."""
self.devices = {} self.devices = {}

View File

@ -121,7 +121,7 @@ class MockNumberEntityDescr(NumberEntity):
Step is calculated based on the smaller max_value and min_value. Step is calculated based on the smaller max_value and min_value.
""" """
def __init__(self): def __init__(self) -> None:
"""Initialize the clas instance.""" """Initialize the clas instance."""
self.entity_description = NumberEntityDescription( self.entity_description = NumberEntityDescription(
"test", "test",
@ -145,7 +145,7 @@ class MockNumberEntityAttrWithDescription(NumberEntity):
members take precedence over the entity description. members take precedence over the entity description.
""" """
def __init__(self): def __init__(self) -> None:
"""Initialize the clas instance.""" """Initialize the clas instance."""
self.entity_description = NumberEntityDescription( self.entity_description = NumberEntityDescription(
"test", "test",
@ -223,7 +223,7 @@ class MockNumberEntityDescrDeprecated(NumberEntity):
Step is calculated based on the smaller max_value and min_value. Step is calculated based on the smaller max_value and min_value.
""" """
def __init__(self): def __init__(self) -> None:
"""Initialize the clas instance.""" """Initialize the clas instance."""
self.entity_description = NumberEntityDescription( self.entity_description = NumberEntityDescription(
"test", "test",

View File

@ -1,6 +1,7 @@
"""OralB session fixtures.""" """OralB session fixtures."""
from collections.abc import Generator from collections.abc import Generator
from typing import Any
from unittest import mock from unittest import mock
import pytest import pytest
@ -19,7 +20,7 @@ class MockBleakClient:
services = MockServices() services = MockServices()
def __init__(self, *args, **kwargs): def __init__(self, *args: Any, **kwargs: Any) -> None:
"""Mock BleakClient.""" """Mock BleakClient."""
async def __aenter__(self, *args, **kwargs): async def __aenter__(self, *args, **kwargs):

View File

@ -537,7 +537,7 @@ async def test_manual_config(hass: HomeAssistant, mock_plex_calls) -> None:
class WrongCertValidaitionException(requests.exceptions.SSLError): class WrongCertValidaitionException(requests.exceptions.SSLError):
"""Mock the exception showing an unmatched error.""" """Mock the exception showing an unmatched error."""
def __init__(self): # pylint: disable=super-init-not-called def __init__(self) -> None: # pylint: disable=super-init-not-called
self.__context__ = ssl.SSLCertVerificationError( self.__context__ = ssl.SSLCertVerificationError(
"some random message that doesn't match" "some random message that doesn't match"
) )

View File

@ -209,7 +209,7 @@ async def test_setup_when_certificate_changed(
class WrongCertHostnameException(requests.exceptions.SSLError): class WrongCertHostnameException(requests.exceptions.SSLError):
"""Mock the exception showing a mismatched hostname.""" """Mock the exception showing a mismatched hostname."""
def __init__(self): # pylint: disable=super-init-not-called def __init__(self) -> None: # pylint: disable=super-init-not-called
self.__context__ = ssl.SSLCertVerificationError( self.__context__ = ssl.SSLCertVerificationError(
f"hostname '{old_domain}' doesn't match" f"hostname '{old_domain}' doesn't match"
) )

View File

@ -284,14 +284,14 @@ async def test_lru_stats(hass: HomeAssistant, caplog: pytest.LogCaptureFixture)
return 1 return 1
class DomainData: class DomainData:
def __init__(self): def __init__(self) -> None:
self._data = LRU(1) self._data = LRU(1)
domain_data = DomainData() domain_data = DomainData()
assert hass.services.has_service(DOMAIN, SERVICE_LRU_STATS) assert hass.services.has_service(DOMAIN, SERVICE_LRU_STATS)
class LRUCache: class LRUCache:
def __init__(self): def __init__(self) -> None:
self._data = {"sqlalchemy_test": 1} self._data = {"sqlalchemy_test": 1}
sqlalchemy_lru_cache = LRUCache() sqlalchemy_lru_cache = LRUCache()

View File

@ -16,6 +16,7 @@ import asyncio
from collections.abc import Generator from collections.abc import Generator
import logging import logging
import threading import threading
from typing import Any
from unittest.mock import Mock, patch from unittest.mock import Mock, patch
from aiohttp import web from aiohttp import web
@ -32,7 +33,7 @@ TEST_TIMEOUT = 7.0 # Lower than 9s home assistant timeout
class WorkerSync: class WorkerSync:
"""Test fixture that intercepts stream worker calls to StreamOutput.""" """Test fixture that intercepts stream worker calls to StreamOutput."""
def __init__(self): def __init__(self) -> None:
"""Initialize WorkerSync.""" """Initialize WorkerSync."""
self._event = None self._event = None
self._original = StreamState.discontinuity self._original = StreamState.discontinuity
@ -74,7 +75,7 @@ def stream_worker_sync() -> Generator[WorkerSync]:
class HLSSync: class HLSSync:
"""Test fixture that intercepts stream worker calls to StreamOutput.""" """Test fixture that intercepts stream worker calls to StreamOutput."""
def __init__(self): def __init__(self) -> None:
"""Initialize HLSSync.""" """Initialize HLSSync."""
self._request_event = asyncio.Event() self._request_event = asyncio.Event()
self._original_recv = StreamOutput.recv self._original_recv = StreamOutput.recv
@ -91,7 +92,7 @@ class HLSSync:
self.check_requests_ready() self.check_requests_ready()
class SyncResponse(web.Response): class SyncResponse(web.Response):
def __init__(self, *args, **kwargs) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
on_resp() on_resp()

View File

@ -160,7 +160,7 @@ class PacketSequence:
class FakePacket(bytearray): class FakePacket(bytearray):
# Be a bytearray so that memoryview works # Be a bytearray so that memoryview works
def __init__(self): def __init__(self) -> None:
super().__init__(3) super().__init__(3)
time_base = VIDEO_TIME_BASE time_base = VIDEO_TIME_BASE
@ -209,7 +209,7 @@ class FakePyAvContainer:
class FakePyAvBuffer: class FakePyAvBuffer:
"""Holds outputs of the decoded stream for tests to assert on results.""" """Holds outputs of the decoded stream for tests to assert on results."""
def __init__(self): def __init__(self) -> None:
"""Initialize the FakePyAvBuffer.""" """Initialize the FakePyAvBuffer."""
self.segments = [] self.segments = []
self.audio_packets = [] self.audio_packets = []

View File

@ -920,7 +920,7 @@ async def test_subscribe_entities_with_unserializable_state(
class CannotSerializeMe: class CannotSerializeMe:
"""Cannot serialize this.""" """Cannot serialize this."""
def __init__(self): def __init__(self) -> None:
"""Init cannot serialize this.""" """Init cannot serialize this."""
hass.states.async_set("light.permitted", "off", {"color": "red"}) hass.states.async_set("light.permitted", "off", {"color": "red"})

View File

@ -4,6 +4,7 @@ from __future__ import annotations
from collections.abc import Generator from collections.abc import Generator
from datetime import datetime from datetime import datetime
from typing import Any
from unittest.mock import AsyncMock, MagicMock, Mock, patch from unittest.mock import AsyncMock, MagicMock, Mock, patch
import pytest import pytest
@ -74,7 +75,7 @@ def mock_whois_missing_some_attrs() -> Generator[Mock]:
class LimitedWhoisMock: class LimitedWhoisMock:
"""A limited mock of whois_query.""" """A limited mock of whois_query."""
def __init__(self, *args, **kwargs): def __init__(self, *args: Any, **kwargs: Any) -> None:
"""Mock only attributes the library always sets being available.""" """Mock only attributes the library always sets being available."""
self.creation_date = datetime(2019, 1, 1, 0, 0, 0) self.creation_date = datetime(2019, 1, 1, 0, 0, 0)
self.dnssec = True self.dnssec = True

View File

@ -19,7 +19,7 @@ class MockBleakClient:
services = MockServices() services = MockServices()
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs) -> None:
"""Mock BleakClient.""" """Mock BleakClient."""
async def __aenter__(self, *args, **kwargs): async def __aenter__(self, *args, **kwargs):

View File

@ -37,7 +37,7 @@ def mock_stream(data):
class AiohttpClientMocker: class AiohttpClientMocker:
"""Mock Aiohttp client requests.""" """Mock Aiohttp client requests."""
def __init__(self): def __init__(self) -> None:
"""Initialize the request mocker.""" """Initialize the request mocker."""
self._mocks = [] self._mocks = []
self._cookies = {} self._cookies = {}
@ -327,7 +327,7 @@ class MockLongPollSideEffect:
If queue is empty, will await until done. If queue is empty, will await until done.
""" """
def __init__(self): def __init__(self) -> None:
"""Initialize the queue.""" """Initialize the queue."""
self.semaphore = asyncio.Semaphore(0) self.semaphore = asyncio.Semaphore(0)
self.response_list = [] self.response_list = []