mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 01:37:08 +00:00
Improve type hints in recollect_waste tests (#123882)
This commit is contained in:
parent
7fe2f175aa
commit
6626c63bb5
@ -1,6 +1,7 @@
|
|||||||
"""Define test fixtures for ReCollect Waste."""
|
"""Define test fixtures for ReCollect Waste."""
|
||||||
|
|
||||||
from datetime import date
|
from datetime import date
|
||||||
|
from typing import Any
|
||||||
from unittest.mock import AsyncMock, Mock, patch
|
from unittest.mock import AsyncMock, Mock, patch
|
||||||
|
|
||||||
from aiorecollect.client import PickupEvent, PickupType
|
from aiorecollect.client import PickupEvent, PickupType
|
||||||
@ -11,6 +12,7 @@ from homeassistant.components.recollect_waste.const import (
|
|||||||
CONF_SERVICE_ID,
|
CONF_SERVICE_ID,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
)
|
)
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
from tests.common import MockConfigEntry
|
from tests.common import MockConfigEntry
|
||||||
|
|
||||||
@ -25,7 +27,9 @@ def client_fixture(pickup_events):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture(name="config_entry")
|
@pytest.fixture(name="config_entry")
|
||||||
def config_entry_fixture(hass, config):
|
def config_entry_fixture(
|
||||||
|
hass: HomeAssistant, config: dict[str, Any]
|
||||||
|
) -> MockConfigEntry:
|
||||||
"""Define a config entry fixture."""
|
"""Define a config entry fixture."""
|
||||||
entry = MockConfigEntry(
|
entry = MockConfigEntry(
|
||||||
domain=DOMAIN, unique_id=f"{TEST_PLACE_ID}, {TEST_SERVICE_ID}", data=config
|
domain=DOMAIN, unique_id=f"{TEST_PLACE_ID}, {TEST_SERVICE_ID}", data=config
|
||||||
@ -35,7 +39,7 @@ def config_entry_fixture(hass, config):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture(name="config")
|
@pytest.fixture(name="config")
|
||||||
def config_fixture():
|
def config_fixture() -> dict[str, Any]:
|
||||||
"""Define a config entry data fixture."""
|
"""Define a config entry data fixture."""
|
||||||
return {
|
return {
|
||||||
CONF_PLACE_ID: TEST_PLACE_ID,
|
CONF_PLACE_ID: TEST_PLACE_ID,
|
||||||
@ -54,7 +58,7 @@ def pickup_events_fixture():
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture(name="mock_aiorecollect")
|
@pytest.fixture(name="mock_aiorecollect")
|
||||||
async def mock_aiorecollect_fixture(client):
|
def mock_aiorecollect_fixture(client):
|
||||||
"""Define a fixture to patch aiorecollect."""
|
"""Define a fixture to patch aiorecollect."""
|
||||||
with (
|
with (
|
||||||
patch(
|
patch(
|
||||||
@ -70,7 +74,9 @@ async def mock_aiorecollect_fixture(client):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture(name="setup_config_entry")
|
@pytest.fixture(name="setup_config_entry")
|
||||||
async def setup_config_entry_fixture(hass, config_entry, mock_aiorecollect):
|
async def setup_config_entry_fixture(
|
||||||
|
hass: HomeAssistant, config_entry: MockConfigEntry, mock_aiorecollect: None
|
||||||
|
) -> None:
|
||||||
"""Define a fixture to set up recollect_waste."""
|
"""Define a fixture to set up recollect_waste."""
|
||||||
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user