mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Improve type hints in smarttub tests (#123910)
This commit is contained in:
parent
c761d75550
commit
ae6ac31d02
@ -1,5 +1,6 @@
|
|||||||
"""Common fixtures for smarttub tests."""
|
"""Common fixtures for smarttub tests."""
|
||||||
|
|
||||||
|
from typing import Any
|
||||||
from unittest.mock import create_autospec, patch
|
from unittest.mock import create_autospec, patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
@ -7,19 +8,20 @@ import smarttub
|
|||||||
|
|
||||||
from homeassistant.components.smarttub.const import DOMAIN
|
from homeassistant.components.smarttub.const import DOMAIN
|
||||||
from homeassistant.const import CONF_EMAIL, CONF_PASSWORD
|
from homeassistant.const import CONF_EMAIL, CONF_PASSWORD
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
|
|
||||||
from tests.common import MockConfigEntry
|
from tests.common import MockConfigEntry
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def config_data():
|
def config_data() -> dict[str, Any]:
|
||||||
"""Provide configuration data for tests."""
|
"""Provide configuration data for tests."""
|
||||||
return {CONF_EMAIL: "test-email", CONF_PASSWORD: "test-password"}
|
return {CONF_EMAIL: "test-email", CONF_PASSWORD: "test-password"}
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def config_entry(config_data):
|
def config_entry(config_data: dict[str, Any]) -> MockConfigEntry:
|
||||||
"""Create a mock config entry."""
|
"""Create a mock config entry."""
|
||||||
return MockConfigEntry(
|
return MockConfigEntry(
|
||||||
domain=DOMAIN,
|
domain=DOMAIN,
|
||||||
@ -29,7 +31,7 @@ def config_entry(config_data):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
async def setup_component(hass):
|
async def setup_component(hass: HomeAssistant) -> None:
|
||||||
"""Set up the component."""
|
"""Set up the component."""
|
||||||
assert await async_setup_component(hass, DOMAIN, {}) is True
|
assert await async_setup_component(hass, DOMAIN, {}) is True
|
||||||
|
|
||||||
@ -162,7 +164,7 @@ def mock_api(account, spa):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
async def setup_entry(hass, config_entry):
|
async def setup_entry(hass: HomeAssistant, config_entry: MockConfigEntry) -> None:
|
||||||
"""Initialize the config entry."""
|
"""Initialize the config entry."""
|
||||||
config_entry.add_to_hass(hass)
|
config_entry.add_to_hass(hass)
|
||||||
await hass.config_entries.async_setup(config_entry.entry_id)
|
await hass.config_entries.async_setup(config_entry.entry_id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user