Improve type hints in anthropic tests (#123784)
This commit is contained in:
parent
3660c2dbb4
commit
4ceb9b9dbf
1 changed files with 8 additions and 3 deletions
|
@ -1,5 +1,6 @@
|
||||||
"""Tests helpers."""
|
"""Tests helpers."""
|
||||||
|
|
||||||
|
from collections.abc import AsyncGenerator
|
||||||
from unittest.mock import AsyncMock, patch
|
from unittest.mock import AsyncMock, patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
@ -13,7 +14,7 @@ from tests.common import MockConfigEntry
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def mock_config_entry(hass):
|
def mock_config_entry(hass: HomeAssistant) -> MockConfigEntry:
|
||||||
"""Mock a config entry."""
|
"""Mock a config entry."""
|
||||||
entry = MockConfigEntry(
|
entry = MockConfigEntry(
|
||||||
title="Claude",
|
title="Claude",
|
||||||
|
@ -27,7 +28,9 @@ def mock_config_entry(hass):
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def mock_config_entry_with_assist(hass, mock_config_entry):
|
def mock_config_entry_with_assist(
|
||||||
|
hass: HomeAssistant, mock_config_entry: MockConfigEntry
|
||||||
|
) -> MockConfigEntry:
|
||||||
"""Mock a config entry with assist."""
|
"""Mock a config entry with assist."""
|
||||||
hass.config_entries.async_update_entry(
|
hass.config_entries.async_update_entry(
|
||||||
mock_config_entry, options={CONF_LLM_HASS_API: llm.LLM_API_ASSIST}
|
mock_config_entry, options={CONF_LLM_HASS_API: llm.LLM_API_ASSIST}
|
||||||
|
@ -36,7 +39,9 @@ def mock_config_entry_with_assist(hass, mock_config_entry):
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
async def mock_init_component(hass, mock_config_entry):
|
async def mock_init_component(
|
||||||
|
hass: HomeAssistant, mock_config_entry: MockConfigEntry
|
||||||
|
) -> AsyncGenerator[None]:
|
||||||
"""Initialize integration."""
|
"""Initialize integration."""
|
||||||
with patch(
|
with patch(
|
||||||
"anthropic.resources.messages.AsyncMessages.create", new_callable=AsyncMock
|
"anthropic.resources.messages.AsyncMessages.create", new_callable=AsyncMock
|
||||||
|
|
Loading…
Add table
Reference in a new issue