Improve type hints in smarttub tests (#123910)

This commit is contained in:
epenet 2024-08-14 16:02:47 +02:00 committed by GitHub
parent c761d75550
commit ae6ac31d02
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,5 +1,6 @@
"""Common fixtures for smarttub tests."""
from typing import Any
from unittest.mock import create_autospec, patch
import pytest
@ -7,19 +8,20 @@ import smarttub
from homeassistant.components.smarttub.const import DOMAIN
from homeassistant.const import CONF_EMAIL, CONF_PASSWORD
from homeassistant.core import HomeAssistant
from homeassistant.setup import async_setup_component
from tests.common import MockConfigEntry
@pytest.fixture
def config_data():
def config_data() -> dict[str, Any]:
"""Provide configuration data for tests."""
return {CONF_EMAIL: "test-email", CONF_PASSWORD: "test-password"}
@pytest.fixture
def config_entry(config_data):
def config_entry(config_data: dict[str, Any]) -> MockConfigEntry:
"""Create a mock config entry."""
return MockConfigEntry(
domain=DOMAIN,
@ -29,7 +31,7 @@ def config_entry(config_data):
@pytest.fixture
async def setup_component(hass):
async def setup_component(hass: HomeAssistant) -> None:
"""Set up the component."""
assert await async_setup_component(hass, DOMAIN, {}) is True
@ -162,7 +164,7 @@ def mock_api(account, spa):
@pytest.fixture
async def setup_entry(hass, config_entry):
async def setup_entry(hass: HomeAssistant, config_entry: MockConfigEntry) -> None:
"""Initialize the config entry."""
config_entry.add_to_hass(hass)
await hass.config_entries.async_setup(config_entry.entry_id)