Add missing return type in test __init__ method (part 2) (#123939)
* Add missing return type in test __init__ method (part 2) * Adjust * One more * One more * More
This commit is contained in:
parent
3322fa0294
commit
3e967700fd
51 changed files with 70 additions and 67 deletions
|
@ -213,7 +213,7 @@ async def reported_properties(hass, endpoint, return_full_response=False):
|
||||||
class ReportedProperties:
|
class ReportedProperties:
|
||||||
"""Class to help assert reported properties."""
|
"""Class to help assert reported properties."""
|
||||||
|
|
||||||
def __init__(self, properties):
|
def __init__(self, properties) -> None:
|
||||||
"""Initialize class."""
|
"""Initialize class."""
|
||||||
self.properties = properties
|
self.properties = properties
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ CONNECT_METHOD = (
|
||||||
class MockConfigDevice:
|
class MockConfigDevice:
|
||||||
"""Mock class to emulate Android device."""
|
"""Mock class to emulate Android device."""
|
||||||
|
|
||||||
def __init__(self, eth_mac=ETH_MAC, wifi_mac=None):
|
def __init__(self, eth_mac=ETH_MAC, wifi_mac=None) -> None:
|
||||||
"""Initialize a fake device to test config flow."""
|
"""Initialize a fake device to test config flow."""
|
||||||
self.available = True
|
self.available = True
|
||||||
self.device_properties = {PROP_ETHMAC: eth_mac, PROP_WIFIMAC: wifi_mac}
|
self.device_properties = {PROP_ETHMAC: eth_mac, PROP_WIFIMAC: wifi_mac}
|
||||||
|
|
|
@ -189,7 +189,7 @@ async def oauth_fixture(
|
||||||
class Client:
|
class Client:
|
||||||
"""Test client with helper methods for application credentials websocket."""
|
"""Test client with helper methods for application credentials websocket."""
|
||||||
|
|
||||||
def __init__(self, client):
|
def __init__(self, client) -> None:
|
||||||
"""Initialize Client."""
|
"""Initialize Client."""
|
||||||
self.client = client
|
self.client = client
|
||||||
self.id = 0
|
self.id = 0
|
||||||
|
|
|
@ -153,7 +153,7 @@ class MockTTSPlatform(MockPlatform):
|
||||||
|
|
||||||
PLATFORM_SCHEMA = tts.PLATFORM_SCHEMA
|
PLATFORM_SCHEMA = tts.PLATFORM_SCHEMA
|
||||||
|
|
||||||
def __init__(self, *, async_get_engine, **kwargs):
|
def __init__(self, *, async_get_engine, **kwargs: Any) -> None:
|
||||||
"""Initialize the tts platform."""
|
"""Initialize the tts platform."""
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
self.async_get_engine = async_get_engine
|
self.async_get_engine = async_get_engine
|
||||||
|
@ -180,7 +180,7 @@ def mock_stt_provider_entity() -> MockSttProviderEntity:
|
||||||
class MockSttPlatform(MockPlatform):
|
class MockSttPlatform(MockPlatform):
|
||||||
"""Provide a fake STT platform."""
|
"""Provide a fake STT platform."""
|
||||||
|
|
||||||
def __init__(self, *, async_get_engine, **kwargs):
|
def __init__(self, *, async_get_engine, **kwargs: Any) -> None:
|
||||||
"""Initialize the stt platform."""
|
"""Initialize the stt platform."""
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
self.async_get_engine = async_get_engine
|
self.async_get_engine = async_get_engine
|
||||||
|
|
|
@ -12,7 +12,7 @@ class MockBAFDevice(Device):
|
||||||
"""A simple mock for a BAF Device."""
|
"""A simple mock for a BAF Device."""
|
||||||
|
|
||||||
# pylint: disable-next=super-init-not-called
|
# pylint: disable-next=super-init-not-called
|
||||||
def __init__(self, async_wait_available_side_effect=None):
|
def __init__(self, async_wait_available_side_effect=None) -> None:
|
||||||
"""Init simple mock."""
|
"""Init simple mock."""
|
||||||
self._async_wait_available_side_effect = async_wait_available_side_effect
|
self._async_wait_available_side_effect = async_wait_available_side_effect
|
||||||
|
|
||||||
|
|
|
@ -212,7 +212,7 @@ async def test_recovery_from_dbus_restart(hass: HomeAssistant) -> None:
|
||||||
mock_discovered = []
|
mock_discovered = []
|
||||||
|
|
||||||
class MockBleakScanner:
|
class MockBleakScanner:
|
||||||
def __init__(self, detection_callback, *args, **kwargs):
|
def __init__(self, detection_callback, *args: Any, **kwargs: Any) -> None:
|
||||||
nonlocal _callback
|
nonlocal _callback
|
||||||
_callback = detection_callback
|
_callback = detection_callback
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ from tests.common import MockConfigEntry
|
||||||
class MockPagination:
|
class MockPagination:
|
||||||
"""Mock pagination result."""
|
"""Mock pagination result."""
|
||||||
|
|
||||||
def __init__(self, value=None):
|
def __init__(self, value=None) -> None:
|
||||||
"""Load simple pagination for tests."""
|
"""Load simple pagination for tests."""
|
||||||
self.next_starting_after = value
|
self.next_starting_after = value
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ class MockPagination:
|
||||||
class MockGetAccounts:
|
class MockGetAccounts:
|
||||||
"""Mock accounts with pagination."""
|
"""Mock accounts with pagination."""
|
||||||
|
|
||||||
def __init__(self, starting_after=0):
|
def __init__(self, starting_after=0) -> None:
|
||||||
"""Init mocked object, forced to return two at a time."""
|
"""Init mocked object, forced to return two at a time."""
|
||||||
if (target_end := starting_after + 2) >= (
|
if (target_end := starting_after + 2) >= (
|
||||||
max_end := len(MOCK_ACCOUNTS_RESPONSE)
|
max_end := len(MOCK_ACCOUNTS_RESPONSE)
|
||||||
|
@ -58,7 +58,7 @@ def mocked_get_accounts(_, **kwargs):
|
||||||
class MockGetAccountsV3:
|
class MockGetAccountsV3:
|
||||||
"""Mock accounts with pagination."""
|
"""Mock accounts with pagination."""
|
||||||
|
|
||||||
def __init__(self, cursor=""):
|
def __init__(self, cursor="") -> None:
|
||||||
"""Init mocked object, forced to return two at a time."""
|
"""Init mocked object, forced to return two at a time."""
|
||||||
ids = [account["uuid"] for account in MOCK_ACCOUNTS_RESPONSE_V3]
|
ids = [account["uuid"] for account in MOCK_ACCOUNTS_RESPONSE_V3]
|
||||||
start = ids.index(cursor) if cursor else 0
|
start = ids.index(cursor) if cursor else 0
|
||||||
|
|
|
@ -18,7 +18,7 @@ CONTRACT = "123456789"
|
||||||
class FidoClientMock:
|
class FidoClientMock:
|
||||||
"""Fake Fido client."""
|
"""Fake Fido client."""
|
||||||
|
|
||||||
def __init__(self, username, password, timeout=None, httpsession=None):
|
def __init__(self, username, password, timeout=None, httpsession=None) -> None:
|
||||||
"""Fake Fido client init."""
|
"""Fake Fido client init."""
|
||||||
|
|
||||||
def get_phone_numbers(self):
|
def get_phone_numbers(self):
|
||||||
|
|
|
@ -8,7 +8,7 @@ from homeassistant.setup import async_setup_component
|
||||||
|
|
||||||
|
|
||||||
class _MockFlicClient:
|
class _MockFlicClient:
|
||||||
def __init__(self, button_addresses):
|
def __init__(self, button_addresses) -> None:
|
||||||
self.addresses = button_addresses
|
self.addresses = button_addresses
|
||||||
self.get_info_callback = None
|
self.get_info_callback = None
|
||||||
self.scan_wizard = None
|
self.scan_wizard = None
|
||||||
|
|
|
@ -36,7 +36,7 @@ def test_event() -> None:
|
||||||
class MockPatternMatchingEventHandler:
|
class MockPatternMatchingEventHandler:
|
||||||
"""Mock base class for the pattern matcher event handler."""
|
"""Mock base class for the pattern matcher event handler."""
|
||||||
|
|
||||||
def __init__(self, patterns):
|
def __init__(self, patterns) -> None:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
with patch(
|
with patch(
|
||||||
|
@ -66,7 +66,7 @@ def test_move_event() -> None:
|
||||||
class MockPatternMatchingEventHandler:
|
class MockPatternMatchingEventHandler:
|
||||||
"""Mock base class for the pattern matcher event handler."""
|
"""Mock base class for the pattern matcher event handler."""
|
||||||
|
|
||||||
def __init__(self, patterns):
|
def __init__(self, patterns) -> None:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
with patch(
|
with patch(
|
||||||
|
|
|
@ -30,7 +30,7 @@ class FritzServiceMock(Service):
|
||||||
class FritzConnectionMock:
|
class FritzConnectionMock:
|
||||||
"""FritzConnection mocking."""
|
"""FritzConnection mocking."""
|
||||||
|
|
||||||
def __init__(self, services):
|
def __init__(self, services) -> None:
|
||||||
"""Init Mocking class."""
|
"""Init Mocking class."""
|
||||||
self.modelname = MOCK_MODELNAME
|
self.modelname = MOCK_MODELNAME
|
||||||
self.call_action = self._call_action
|
self.call_action = self._call_action
|
||||||
|
|
|
@ -74,7 +74,7 @@ def upcoming_event_url(entity: str = TEST_ENTITY) -> str:
|
||||||
class Client:
|
class Client:
|
||||||
"""Test client with helper methods for calendar websocket."""
|
"""Test client with helper methods for calendar websocket."""
|
||||||
|
|
||||||
def __init__(self, client):
|
def __init__(self, client) -> None:
|
||||||
"""Initialize Client."""
|
"""Initialize Client."""
|
||||||
self.client = client
|
self.client = client
|
||||||
self.id = 0
|
self.id = 0
|
||||||
|
|
|
@ -60,7 +60,7 @@ REFERENCE = {
|
||||||
class TelnetMock:
|
class TelnetMock:
|
||||||
"""Mock class for the telnetlib.Telnet object."""
|
"""Mock class for the telnetlib.Telnet object."""
|
||||||
|
|
||||||
def __init__(self, host, port, timeout=0):
|
def __init__(self, host, port, timeout=0) -> None:
|
||||||
"""Initialize Telnet object."""
|
"""Initialize Telnet object."""
|
||||||
self.host = host
|
self.host = host
|
||||||
self.port = port
|
self.port = port
|
||||||
|
|
|
@ -8,7 +8,7 @@ from homeassistant.components.hdmi_cec import KeyPressCommand, KeyReleaseCommand
|
||||||
class MockHDMIDevice:
|
class MockHDMIDevice:
|
||||||
"""Mock of a HDMIDevice."""
|
"""Mock of a HDMIDevice."""
|
||||||
|
|
||||||
def __init__(self, *, logical_address, **values):
|
def __init__(self, *, logical_address, **values) -> None:
|
||||||
"""Mock of a HDMIDevice."""
|
"""Mock of a HDMIDevice."""
|
||||||
self.set_update_callback = Mock(side_effect=self._set_update_callback)
|
self.set_update_callback = Mock(side_effect=self._set_update_callback)
|
||||||
self.logical_address = logical_address
|
self.logical_address = logical_address
|
||||||
|
|
|
@ -12,7 +12,7 @@ from homeassistant.data_entry_flow import FlowResultType
|
||||||
class MockSW16Client:
|
class MockSW16Client:
|
||||||
"""Class to mock the SW16Client client."""
|
"""Class to mock the SW16Client client."""
|
||||||
|
|
||||||
def __init__(self, fail):
|
def __init__(self, fail) -> None:
|
||||||
"""Initialise client with failure modes."""
|
"""Initialise client with failure modes."""
|
||||||
self.fail = fail
|
self.fail = fail
|
||||||
self.disconnect_callback = None
|
self.disconnect_callback = None
|
||||||
|
|
|
@ -132,7 +132,7 @@ class HomeTemplate(Home):
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, connection=None, home_name="", test_devices=None, test_groups=None
|
self, connection=None, home_name="", test_devices=None, test_groups=None
|
||||||
):
|
) -> None:
|
||||||
"""Init template with connection."""
|
"""Init template with connection."""
|
||||||
super().__init__(connection=connection)
|
super().__init__(connection=connection)
|
||||||
self.name = home_name
|
self.name = home_name
|
||||||
|
|
|
@ -119,7 +119,7 @@ async def test_cors_middleware_with_cors_allowed_view(hass: HomeAssistant) -> No
|
||||||
requires_auth = False
|
requires_auth = False
|
||||||
cors_allowed = True
|
cors_allowed = True
|
||||||
|
|
||||||
def __init__(self, url, name):
|
def __init__(self, url, name) -> None:
|
||||||
"""Initialize test view."""
|
"""Initialize test view."""
|
||||||
self.url = url
|
self.url = url
|
||||||
self.name = name
|
self.name = name
|
||||||
|
|
|
@ -30,7 +30,7 @@ class MockSwitchLinc(SwitchedLightingControl_SwitchLinc02):
|
||||||
class MockDevices:
|
class MockDevices:
|
||||||
"""Mock devices class."""
|
"""Mock devices class."""
|
||||||
|
|
||||||
def __init__(self, connected=True):
|
def __init__(self, connected=True) -> None:
|
||||||
"""Init the MockDevices class."""
|
"""Init the MockDevices class."""
|
||||||
self._devices = {}
|
self._devices = {}
|
||||||
self.modem = None
|
self.modem = None
|
||||||
|
|
|
@ -53,7 +53,7 @@ SERVICE_INFO = BluetoothServiceInfoBleak(
|
||||||
class MockMicroBotApiClient:
|
class MockMicroBotApiClient:
|
||||||
"""Mock MicroBotApiClient."""
|
"""Mock MicroBotApiClient."""
|
||||||
|
|
||||||
def __init__(self, device, token):
|
def __init__(self, device, token) -> None:
|
||||||
"""Mock init."""
|
"""Mock init."""
|
||||||
|
|
||||||
async def connect(self, init):
|
async def connect(self, init):
|
||||||
|
@ -70,7 +70,7 @@ class MockMicroBotApiClient:
|
||||||
class MockMicroBotApiClientFail:
|
class MockMicroBotApiClientFail:
|
||||||
"""Mock MicroBotApiClient."""
|
"""Mock MicroBotApiClient."""
|
||||||
|
|
||||||
def __init__(self, device, token):
|
def __init__(self, device, token) -> None:
|
||||||
"""Mock init."""
|
"""Mock init."""
|
||||||
|
|
||||||
async def connect(self, init):
|
async def connect(self, init):
|
||||||
|
|
|
@ -126,7 +126,7 @@ def _gateway_descriptor(
|
||||||
class GatewayScannerMock:
|
class GatewayScannerMock:
|
||||||
"""Mock GatewayScanner."""
|
"""Mock GatewayScanner."""
|
||||||
|
|
||||||
def __init__(self, gateways=None):
|
def __init__(self, gateways=None) -> None:
|
||||||
"""Initialize GatewayScannerMock."""
|
"""Initialize GatewayScannerMock."""
|
||||||
# Key is a HPAI instance in xknx, but not used in HA anyway.
|
# Key is a HPAI instance in xknx, but not used in HA anyway.
|
||||||
self.found_gateways = (
|
self.found_gateways = (
|
||||||
|
|
|
@ -63,7 +63,7 @@ def get_kodi_connection(
|
||||||
class MockConnection:
|
class MockConnection:
|
||||||
"""A mock kodi connection."""
|
"""A mock kodi connection."""
|
||||||
|
|
||||||
def __init__(self, connected=True):
|
def __init__(self, connected=True) -> None:
|
||||||
"""Mock the Kodi connection."""
|
"""Mock the Kodi connection."""
|
||||||
self._connected = connected
|
self._connected = connected
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ class MockConnection:
|
||||||
class MockWSConnection:
|
class MockWSConnection:
|
||||||
"""A mock kodi websocket connection."""
|
"""A mock kodi websocket connection."""
|
||||||
|
|
||||||
def __init__(self, connected=True):
|
def __init__(self, connected=True) -> None:
|
||||||
"""Mock the websocket connection."""
|
"""Mock the websocket connection."""
|
||||||
self._connected = connected
|
self._connected = connected
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ DEFAULT_ENTRY_TITLE = LABEL
|
||||||
class MockMessage:
|
class MockMessage:
|
||||||
"""Mock a lifx message."""
|
"""Mock a lifx message."""
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs: Any) -> None:
|
||||||
"""Init message."""
|
"""Init message."""
|
||||||
self.target_addr = SERIAL
|
self.target_addr = SERIAL
|
||||||
self.count = 9
|
self.count = 9
|
||||||
|
@ -38,7 +38,7 @@ class MockMessage:
|
||||||
class MockFailingLifxCommand:
|
class MockFailingLifxCommand:
|
||||||
"""Mock a lifx command that fails."""
|
"""Mock a lifx command that fails."""
|
||||||
|
|
||||||
def __init__(self, bulb, **kwargs):
|
def __init__(self, bulb, **kwargs: Any) -> None:
|
||||||
"""Init command."""
|
"""Init command."""
|
||||||
self.bulb = bulb
|
self.bulb = bulb
|
||||||
self.calls = []
|
self.calls = []
|
||||||
|
@ -61,7 +61,7 @@ class MockLifxCommand:
|
||||||
"""Return name."""
|
"""Return name."""
|
||||||
return "mock_lifx_command"
|
return "mock_lifx_command"
|
||||||
|
|
||||||
def __init__(self, bulb, **kwargs):
|
def __init__(self, bulb, **kwargs: Any) -> None:
|
||||||
"""Init command."""
|
"""Init command."""
|
||||||
self.bulb = bulb
|
self.bulb = bulb
|
||||||
self.calls = []
|
self.calls = []
|
||||||
|
|
|
@ -575,7 +575,7 @@ async def test_suggested_area(
|
||||||
class MockLifxCommandGetGroup:
|
class MockLifxCommandGetGroup:
|
||||||
"""Mock the get_group method that gets the group name from the bulb."""
|
"""Mock the get_group method that gets the group name from the bulb."""
|
||||||
|
|
||||||
def __init__(self, bulb, **kwargs):
|
def __init__(self, bulb, **kwargs: Any) -> None:
|
||||||
"""Init command."""
|
"""Init command."""
|
||||||
self.bulb = bulb
|
self.bulb = bulb
|
||||||
self.lifx_group = kwargs.get("lifx_group")
|
self.lifx_group = kwargs.get("lifx_group")
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
"""Tests for the lifx integration light platform."""
|
"""Tests for the lifx integration light platform."""
|
||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
from typing import Any
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
import aiolifx_effects
|
import aiolifx_effects
|
||||||
|
@ -1299,7 +1300,7 @@ async def test_config_zoned_light_strip_fails(
|
||||||
class MockFailingLifxCommand:
|
class MockFailingLifxCommand:
|
||||||
"""Mock a lifx command that fails on the 2nd try."""
|
"""Mock a lifx command that fails on the 2nd try."""
|
||||||
|
|
||||||
def __init__(self, bulb, **kwargs):
|
def __init__(self, bulb, **kwargs: Any) -> None:
|
||||||
"""Init command."""
|
"""Init command."""
|
||||||
self.bulb = bulb
|
self.bulb = bulb
|
||||||
self.call_count = 0
|
self.call_count = 0
|
||||||
|
@ -1338,7 +1339,7 @@ async def test_legacy_zoned_light_strip(
|
||||||
class MockPopulateLifxZonesCommand:
|
class MockPopulateLifxZonesCommand:
|
||||||
"""Mock populating the number of zones."""
|
"""Mock populating the number of zones."""
|
||||||
|
|
||||||
def __init__(self, bulb, **kwargs):
|
def __init__(self, bulb, **kwargs: Any) -> None:
|
||||||
"""Init command."""
|
"""Init command."""
|
||||||
self.bulb = bulb
|
self.bulb = bulb
|
||||||
self.call_count = 0
|
self.call_count = 0
|
||||||
|
@ -1845,7 +1846,7 @@ async def test_color_bulb_is_actually_off(hass: HomeAssistant) -> None:
|
||||||
class MockLifxCommandActuallyOff:
|
class MockLifxCommandActuallyOff:
|
||||||
"""Mock a lifx command that will update our power level state."""
|
"""Mock a lifx command that will update our power level state."""
|
||||||
|
|
||||||
def __init__(self, bulb, **kwargs):
|
def __init__(self, bulb, **kwargs: Any) -> None:
|
||||||
"""Init command."""
|
"""Init command."""
|
||||||
self.bulb = bulb
|
self.bulb = bulb
|
||||||
self.calls = []
|
self.calls = []
|
||||||
|
|
|
@ -101,7 +101,7 @@ async def async_setup_integration(hass: HomeAssistant, mock_bridge) -> MockConfi
|
||||||
class MockBridge:
|
class MockBridge:
|
||||||
"""Mock Lutron bridge that emulates configured connected status."""
|
"""Mock Lutron bridge that emulates configured connected status."""
|
||||||
|
|
||||||
def __init__(self, can_connect=True):
|
def __init__(self, can_connect=True) -> None:
|
||||||
"""Initialize MockBridge instance with configured mock connectivity."""
|
"""Initialize MockBridge instance with configured mock connectivity."""
|
||||||
self.can_connect = can_connect
|
self.can_connect = can_connect
|
||||||
self.is_currently_connected = False
|
self.is_currently_connected = False
|
||||||
|
|
|
@ -37,7 +37,7 @@ TEST_PORT_SERIAL = "usb01"
|
||||||
class ReadResult:
|
class ReadResult:
|
||||||
"""Storage class for register read results."""
|
"""Storage class for register read results."""
|
||||||
|
|
||||||
def __init__(self, register_words):
|
def __init__(self, register_words) -> None:
|
||||||
"""Init."""
|
"""Init."""
|
||||||
self.registers = register_words
|
self.registers = register_words
|
||||||
self.bits = register_words
|
self.bits = register_words
|
||||||
|
|
|
@ -23,7 +23,9 @@ VALID_CONFIG_EXPECTED_ENTITY_IDS = ["my_fake_station_p95", "my_fake_station_e10"
|
||||||
class MockPrice:
|
class MockPrice:
|
||||||
"""Mock Price implementation."""
|
"""Mock Price implementation."""
|
||||||
|
|
||||||
def __init__(self, price, fuel_type, last_updated, price_unit, station_code):
|
def __init__(
|
||||||
|
self, price, fuel_type, last_updated, price_unit, station_code
|
||||||
|
) -> None:
|
||||||
"""Initialize a mock price instance."""
|
"""Initialize a mock price instance."""
|
||||||
self.price = price
|
self.price = price
|
||||||
self.fuel_type = fuel_type
|
self.fuel_type = fuel_type
|
||||||
|
@ -35,7 +37,7 @@ class MockPrice:
|
||||||
class MockStation:
|
class MockStation:
|
||||||
"""Mock Station implementation."""
|
"""Mock Station implementation."""
|
||||||
|
|
||||||
def __init__(self, name, code):
|
def __init__(self, name, code) -> None:
|
||||||
"""Initialize a mock Station instance."""
|
"""Initialize a mock Station instance."""
|
||||||
self.name = name
|
self.name = name
|
||||||
self.code = code
|
self.code = code
|
||||||
|
@ -44,7 +46,7 @@ class MockStation:
|
||||||
class MockGetFuelPricesResponse:
|
class MockGetFuelPricesResponse:
|
||||||
"""Mock GetFuelPricesResponse implementation."""
|
"""Mock GetFuelPricesResponse implementation."""
|
||||||
|
|
||||||
def __init__(self, prices, stations):
|
def __init__(self, prices, stations) -> None:
|
||||||
"""Initialize a mock GetFuelPricesResponse instance."""
|
"""Initialize a mock GetFuelPricesResponse instance."""
|
||||||
self.prices = prices
|
self.prices = prices
|
||||||
self.stations = stations
|
self.stations = stations
|
||||||
|
|
|
@ -15,7 +15,7 @@ class NumatoModuleMock:
|
||||||
class NumatoDeviceMock:
|
class NumatoDeviceMock:
|
||||||
"""Mockup for the numato_gpio.NumatoUsbGpio class."""
|
"""Mockup for the numato_gpio.NumatoUsbGpio class."""
|
||||||
|
|
||||||
def __init__(self, device):
|
def __init__(self, device) -> None:
|
||||||
"""Initialize numato device mockup."""
|
"""Initialize numato device mockup."""
|
||||||
self.device = device
|
self.device = device
|
||||||
self.callbacks = {}
|
self.callbacks = {}
|
||||||
|
|
|
@ -40,7 +40,7 @@ class PilightDaemonSim:
|
||||||
"message": {"id": 0, "unit": 0, "off": 1},
|
"message": {"id": 0, "unit": 0, "off": 1},
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, host, port):
|
def __init__(self, host, port) -> None:
|
||||||
"""Init pilight client, ignore parameters."""
|
"""Init pilight client, ignore parameters."""
|
||||||
|
|
||||||
def send_code(self, call):
|
def send_code(self, call):
|
||||||
|
|
|
@ -67,7 +67,7 @@ GDM_CLIENT_PAYLOAD = [
|
||||||
class MockGDM:
|
class MockGDM:
|
||||||
"""Mock a GDM instance."""
|
"""Mock a GDM instance."""
|
||||||
|
|
||||||
def __init__(self, disabled=False):
|
def __init__(self, disabled=False) -> None:
|
||||||
"""Initialize the object."""
|
"""Initialize the object."""
|
||||||
self.entries = []
|
self.entries = []
|
||||||
self.disabled = disabled
|
self.disabled = disabled
|
||||||
|
|
|
@ -28,7 +28,7 @@ class MockPlexMedia:
|
||||||
viewOffset = 333
|
viewOffset = 333
|
||||||
_server = Mock(_baseurl=PLEX_DIRECT_URL)
|
_server = Mock(_baseurl=PLEX_DIRECT_URL)
|
||||||
|
|
||||||
def __init__(self, title, mediatype):
|
def __init__(self, title, mediatype) -> None:
|
||||||
"""Initialize the instance."""
|
"""Initialize the instance."""
|
||||||
self.listType = mediatype
|
self.listType = mediatype
|
||||||
self.title = title
|
self.title = title
|
||||||
|
|
|
@ -176,7 +176,7 @@ async def test_dump_log_object(
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
class DumpLogDummy:
|
class DumpLogDummy:
|
||||||
def __init__(self, fail):
|
def __init__(self, fail) -> None:
|
||||||
self.fail = fail
|
self.fail = fail
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
|
|
|
@ -356,7 +356,7 @@ class LazyState(State):
|
||||||
"_context",
|
"_context",
|
||||||
]
|
]
|
||||||
|
|
||||||
def __init__(self, row): # pylint: disable=super-init-not-called
|
def __init__(self, row) -> None: # pylint: disable=super-init-not-called
|
||||||
"""Init the lazy state."""
|
"""Init the lazy state."""
|
||||||
self._row = row
|
self._row = row
|
||||||
self.entity_id = self._row.entity_id
|
self.entity_id = self._row.entity_id
|
||||||
|
|
|
@ -369,7 +369,7 @@ class LazyState(State):
|
||||||
"_context",
|
"_context",
|
||||||
]
|
]
|
||||||
|
|
||||||
def __init__(self, row): # pylint: disable=super-init-not-called
|
def __init__(self, row) -> None: # pylint: disable=super-init-not-called
|
||||||
"""Init the lazy state."""
|
"""Init the lazy state."""
|
||||||
self._row = row
|
self._row = row
|
||||||
self.entity_id = self._row.entity_id
|
self.entity_id = self._row.entity_id
|
||||||
|
|
|
@ -488,7 +488,7 @@ class LazyState(State):
|
||||||
"_context",
|
"_context",
|
||||||
]
|
]
|
||||||
|
|
||||||
def __init__(self, row): # pylint: disable=super-init-not-called
|
def __init__(self, row) -> None: # pylint: disable=super-init-not-called
|
||||||
"""Init the lazy state."""
|
"""Init the lazy state."""
|
||||||
self._row = row
|
self._row = row
|
||||||
self.entity_id = self._row.entity_id
|
self.entity_id = self._row.entity_id
|
||||||
|
|
|
@ -478,7 +478,7 @@ class LazyState(State):
|
||||||
"_context",
|
"_context",
|
||||||
]
|
]
|
||||||
|
|
||||||
def __init__(self, row): # pylint: disable=super-init-not-called
|
def __init__(self, row) -> None: # pylint: disable=super-init-not-called
|
||||||
"""Init the lazy state."""
|
"""Init the lazy state."""
|
||||||
self._row = row
|
self._row = row
|
||||||
self.entity_id = self._row.entity_id
|
self.entity_id = self._row.entity_id
|
||||||
|
|
|
@ -602,7 +602,7 @@ class LazyState(State):
|
||||||
"_context",
|
"_context",
|
||||||
]
|
]
|
||||||
|
|
||||||
def __init__(self, row): # pylint: disable=super-init-not-called
|
def __init__(self, row) -> None: # pylint: disable=super-init-not-called
|
||||||
"""Init the lazy state."""
|
"""Init the lazy state."""
|
||||||
self._row = row
|
self._row = row
|
||||||
self.entity_id = self._row.entity_id
|
self.entity_id = self._row.entity_id
|
||||||
|
|
|
@ -990,7 +990,7 @@ async def test_execute_stmt_lambda_element(
|
||||||
all_calls = 0
|
all_calls = 0
|
||||||
|
|
||||||
class MockExecutor:
|
class MockExecutor:
|
||||||
def __init__(self, stmt):
|
def __init__(self, stmt) -> None:
|
||||||
assert isinstance(stmt, StatementLambdaElement)
|
assert isinstance(stmt, StatementLambdaElement)
|
||||||
|
|
||||||
def all(self):
|
def all(self):
|
||||||
|
|
|
@ -66,7 +66,7 @@ INVALID_SORT_BY_CONFIG = {
|
||||||
class ObjectView:
|
class ObjectView:
|
||||||
"""Use dict properties as attributes."""
|
"""Use dict properties as attributes."""
|
||||||
|
|
||||||
def __init__(self, d):
|
def __init__(self, d) -> None:
|
||||||
"""Set dict as internal dict."""
|
"""Set dict as internal dict."""
|
||||||
self.__dict__ = d
|
self.__dict__ = d
|
||||||
|
|
||||||
|
|
|
@ -179,7 +179,7 @@ def rest_api_fixture_non_ssl_only() -> Mock:
|
||||||
class MockSamsungTVAsyncRest:
|
class MockSamsungTVAsyncRest:
|
||||||
"""Mock for a MockSamsungTVAsyncRest."""
|
"""Mock for a MockSamsungTVAsyncRest."""
|
||||||
|
|
||||||
def __init__(self, host, session, port, timeout):
|
def __init__(self, host, session, port, timeout) -> None:
|
||||||
"""Mock a MockSamsungTVAsyncRest."""
|
"""Mock a MockSamsungTVAsyncRest."""
|
||||||
self.port = port
|
self.port = port
|
||||||
self.host = host
|
self.host = host
|
||||||
|
|
|
@ -80,7 +80,7 @@ class SonosMockService:
|
||||||
class SonosMockEvent:
|
class SonosMockEvent:
|
||||||
"""Mock a sonos Event used in callbacks."""
|
"""Mock a sonos Event used in callbacks."""
|
||||||
|
|
||||||
def __init__(self, soco, service, variables):
|
def __init__(self, soco, service, variables) -> None:
|
||||||
"""Initialize the instance."""
|
"""Initialize the instance."""
|
||||||
self.sid = f"{soco.uid}_sub0000000001"
|
self.sid = f"{soco.uid}_sub0000000001"
|
||||||
self.seq = "0"
|
self.seq = "0"
|
||||||
|
|
|
@ -54,7 +54,7 @@ async def setup_component(hass: HomeAssistant) -> None:
|
||||||
class HlsClient:
|
class HlsClient:
|
||||||
"""Test fixture for fetching the hls stream."""
|
"""Test fixture for fetching the hls stream."""
|
||||||
|
|
||||||
def __init__(self, http_client, parsed_url):
|
def __init__(self, http_client, parsed_url) -> None:
|
||||||
"""Initialize HlsClient."""
|
"""Initialize HlsClient."""
|
||||||
self.http_client = http_client
|
self.http_client = http_client
|
||||||
self.parsed_url = parsed_url
|
self.parsed_url = parsed_url
|
||||||
|
|
|
@ -100,7 +100,7 @@ def mock_stream_settings(hass: HomeAssistant) -> None:
|
||||||
class FakeAvInputStream:
|
class FakeAvInputStream:
|
||||||
"""A fake pyav Stream."""
|
"""A fake pyav Stream."""
|
||||||
|
|
||||||
def __init__(self, name, time_base):
|
def __init__(self, name, time_base) -> None:
|
||||||
"""Initialize the stream."""
|
"""Initialize the stream."""
|
||||||
self.name = name
|
self.name = name
|
||||||
self.time_base = time_base
|
self.time_base = time_base
|
||||||
|
@ -142,7 +142,7 @@ class PacketSequence:
|
||||||
exercise corner cases.
|
exercise corner cases.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, num_packets):
|
def __init__(self, num_packets) -> None:
|
||||||
"""Initialize the sequence with the number of packets it provides."""
|
"""Initialize the sequence with the number of packets it provides."""
|
||||||
self.packet = 0
|
self.packet = 0
|
||||||
self.num_packets = num_packets
|
self.num_packets = num_packets
|
||||||
|
@ -181,7 +181,7 @@ class PacketSequence:
|
||||||
class FakePyAvContainer:
|
class FakePyAvContainer:
|
||||||
"""A fake container returned by mock av.open for a stream."""
|
"""A fake container returned by mock av.open for a stream."""
|
||||||
|
|
||||||
def __init__(self, video_stream, audio_stream):
|
def __init__(self, video_stream, audio_stream) -> None:
|
||||||
"""Initialize the fake container."""
|
"""Initialize the fake container."""
|
||||||
# Tests can override this to trigger different worker behavior
|
# Tests can override this to trigger different worker behavior
|
||||||
self.packets = PacketSequence(0)
|
self.packets = PacketSequence(0)
|
||||||
|
@ -220,7 +220,7 @@ class FakePyAvBuffer:
|
||||||
"""Create an output buffer that captures packets for test to examine."""
|
"""Create an output buffer that captures packets for test to examine."""
|
||||||
|
|
||||||
class FakeAvOutputStream:
|
class FakeAvOutputStream:
|
||||||
def __init__(self, capture_packets):
|
def __init__(self, capture_packets) -> None:
|
||||||
self.capture_packets = capture_packets
|
self.capture_packets = capture_packets
|
||||||
self.type = "ignored-type"
|
self.type = "ignored-type"
|
||||||
|
|
||||||
|
@ -266,7 +266,7 @@ class FakePyAvBuffer:
|
||||||
class MockPyAv:
|
class MockPyAv:
|
||||||
"""Mocks out av.open."""
|
"""Mocks out av.open."""
|
||||||
|
|
||||||
def __init__(self, video=True, audio=False):
|
def __init__(self, video=True, audio=False) -> None:
|
||||||
"""Initialize the MockPyAv."""
|
"""Initialize the MockPyAv."""
|
||||||
video_stream = VIDEO_STREAM if video else None
|
video_stream = VIDEO_STREAM if video else None
|
||||||
audio_stream = AUDIO_STREAM if audio else None
|
audio_stream = AUDIO_STREAM if audio else None
|
||||||
|
|
|
@ -25,7 +25,7 @@ def mock_session_response(*args, **kwargs):
|
||||||
"""Mock data generation for session response."""
|
"""Mock data generation for session response."""
|
||||||
|
|
||||||
class MockSessionResponse:
|
class MockSessionResponse:
|
||||||
def __init__(self, text, status_code):
|
def __init__(self, text, status_code) -> None:
|
||||||
self.text = text
|
self.text = text
|
||||||
self.status_code = status_code
|
self.status_code = status_code
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ class VenstarColorTouchMock:
|
||||||
pin=None,
|
pin=None,
|
||||||
proto="http",
|
proto="http",
|
||||||
SSLCert=False,
|
SSLCert=False,
|
||||||
):
|
) -> None:
|
||||||
"""Initialize the Venstar library."""
|
"""Initialize the Venstar library."""
|
||||||
self.status = {}
|
self.status = {}
|
||||||
self.model = "COLORTOUCH"
|
self.model = "COLORTOUCH"
|
||||||
|
|
|
@ -83,7 +83,7 @@ def new_simple_controller_config(
|
||||||
class ComponentFactory:
|
class ComponentFactory:
|
||||||
"""Factory class."""
|
"""Factory class."""
|
||||||
|
|
||||||
def __init__(self, vera_controller_class_mock):
|
def __init__(self, vera_controller_class_mock) -> None:
|
||||||
"""Initialize the factory."""
|
"""Initialize the factory."""
|
||||||
self.vera_controller_class_mock = vera_controller_class_mock
|
self.vera_controller_class_mock = vera_controller_class_mock
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ from .const import (
|
||||||
class MockInput:
|
class MockInput:
|
||||||
"""Mock Vizio device input."""
|
"""Mock Vizio device input."""
|
||||||
|
|
||||||
def __init__(self, name):
|
def __init__(self, name) -> None:
|
||||||
"""Initialize mock Vizio device input."""
|
"""Initialize mock Vizio device input."""
|
||||||
self.meta_name = name
|
self.meta_name = name
|
||||||
self.name = name
|
self.name = name
|
||||||
|
|
|
@ -73,7 +73,7 @@ class AttrDict(dict):
|
||||||
class MockWs66i:
|
class MockWs66i:
|
||||||
"""Mock for pyws66i object."""
|
"""Mock for pyws66i object."""
|
||||||
|
|
||||||
def __init__(self, fail_open=False, fail_zone_check=None):
|
def __init__(self, fail_open=False, fail_zone_check=None) -> None:
|
||||||
"""Init mock object."""
|
"""Init mock object."""
|
||||||
self.zones = defaultdict(
|
self.zones = defaultdict(
|
||||||
lambda: AttrDict(
|
lambda: AttrDict(
|
||||||
|
|
|
@ -25,7 +25,7 @@ def _create_zone_mock(name, url):
|
||||||
class FakeYamahaDevice:
|
class FakeYamahaDevice:
|
||||||
"""A fake Yamaha device."""
|
"""A fake Yamaha device."""
|
||||||
|
|
||||||
def __init__(self, ctrl_url, name, zones=None):
|
def __init__(self, ctrl_url, name, zones=None) -> None:
|
||||||
"""Initialize the fake Yamaha device."""
|
"""Initialize the fake Yamaha device."""
|
||||||
self.ctrl_url = ctrl_url
|
self.ctrl_url = ctrl_url
|
||||||
self.name = name
|
self.name = name
|
||||||
|
|
|
@ -109,7 +109,7 @@ CONFIG_ENTRY_DATA = {CONF_ID: ID}
|
||||||
class MockAsyncBulb:
|
class MockAsyncBulb:
|
||||||
"""A mock for yeelight.aio.AsyncBulb."""
|
"""A mock for yeelight.aio.AsyncBulb."""
|
||||||
|
|
||||||
def __init__(self, model, bulb_type, cannot_connect):
|
def __init__(self, model, bulb_type, cannot_connect) -> None:
|
||||||
"""Init the mock."""
|
"""Init the mock."""
|
||||||
self.model = model
|
self.model = model
|
||||||
self.bulb_type = bulb_type
|
self.bulb_type = bulb_type
|
||||||
|
|
|
@ -174,7 +174,7 @@ class AiohttpClientMockResponse:
|
||||||
headers=None,
|
headers=None,
|
||||||
side_effect=None,
|
side_effect=None,
|
||||||
closing=None,
|
closing=None,
|
||||||
):
|
) -> None:
|
||||||
"""Initialize a fake response."""
|
"""Initialize a fake response."""
|
||||||
if json is not None:
|
if json is not None:
|
||||||
text = json_dumps(json)
|
text = json_dumps(json)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue