mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 04:07:08 +00:00
Add missing hass type hint in component tests (b) (#124065)
This commit is contained in:
parent
1afed8ae15
commit
489ceab4b5
@ -9,6 +9,7 @@ import pytest
|
||||
|
||||
from homeassistant.components.blebox.const import DOMAIN
|
||||
from homeassistant.const import CONF_HOST, CONF_PORT
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
@ -77,7 +78,9 @@ def feature_fixture(request: pytest.FixtureRequest) -> Any:
|
||||
return request.getfixturevalue(request.param)
|
||||
|
||||
|
||||
async def async_setup_entities(hass, entity_ids):
|
||||
async def async_setup_entities(
|
||||
hass: HomeAssistant, entity_ids: list[str]
|
||||
) -> list[er.RegistryEntry]:
|
||||
"""Return configured entries with the given entity ids."""
|
||||
|
||||
config_entry = mock_config()
|
||||
@ -90,7 +93,7 @@ async def async_setup_entities(hass, entity_ids):
|
||||
return [entity_registry.async_get(entity_id) for entity_id in entity_ids]
|
||||
|
||||
|
||||
async def async_setup_entity(hass, entity_id):
|
||||
async def async_setup_entity(hass: HomeAssistant, entity_id: str) -> er.RegistryEntry:
|
||||
"""Return a configured entry with the given entity_id."""
|
||||
|
||||
return (await async_setup_entities(hass, [entity_id]))[0]
|
||||
|
@ -22,7 +22,7 @@ from homeassistant.components.bluetooth import (
|
||||
HaBluetoothConnector,
|
||||
HomeAssistantBluetoothManager,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.core import CALLBACK_TYPE, HomeAssistant
|
||||
|
||||
from . import _get_manager, generate_advertisement_data, generate_ble_device
|
||||
|
||||
@ -164,7 +164,11 @@ def mock_platform_client_that_raises_on_connect_fixture():
|
||||
yield
|
||||
|
||||
|
||||
def _generate_scanners_with_fake_devices(hass):
|
||||
def _generate_scanners_with_fake_devices(
|
||||
hass: HomeAssistant,
|
||||
) -> tuple[
|
||||
dict[str, tuple[BLEDevice, AdvertisementData]], CALLBACK_TYPE, CALLBACK_TYPE
|
||||
]:
|
||||
"""Generate scanners with fake devices."""
|
||||
manager = _get_manager()
|
||||
hci0_device_advs = {}
|
||||
|
@ -4,6 +4,7 @@ from dataclasses import dataclass
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from homeassistant.components.broadlink.const import DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@ -137,7 +138,12 @@ class BroadlinkDevice:
|
||||
self.timeout = timeout
|
||||
self.fwversion = fwversion
|
||||
|
||||
async def setup_entry(self, hass, mock_api=None, mock_entry=None):
|
||||
async def setup_entry(
|
||||
self,
|
||||
hass: HomeAssistant,
|
||||
mock_api: MagicMock | None = None,
|
||||
mock_entry: MockConfigEntry | None = None,
|
||||
) -> MockSetup:
|
||||
"""Set up the device."""
|
||||
mock_api = mock_api or self.get_mock_api()
|
||||
mock_entry = mock_entry or self.get_mock_entry()
|
||||
|
@ -8,6 +8,7 @@ from http import HTTPStatus
|
||||
from aiohttp.client_exceptions import ClientResponseError
|
||||
|
||||
from homeassistant.components.buienradar.const import CONF_DELTA, DOMAIN
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_COUNTRY_CODE, CONF_LATITUDE, CONF_LONGITUDE
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
@ -31,7 +32,7 @@ def radar_map_url(country_code: str = "NL") -> str:
|
||||
return f"https://api.buienradar.nl/image/1.0/RadarMap{country_code}?w=700&h=700"
|
||||
|
||||
|
||||
async def _setup_config_entry(hass, entry):
|
||||
async def _setup_config_entry(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
||||
entity_registry = er.async_get(hass)
|
||||
entity_registry.async_get_or_create(
|
||||
domain="camera",
|
||||
|
Loading…
x
Reference in New Issue
Block a user