Add SnapshotAssertion type hints in tests (#118371)
parent
166c588cac
commit
1fbf93fd36
|
@ -4,6 +4,7 @@ import json
|
|||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
from syrupy import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.blueprint import importer
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
@ -53,7 +54,9 @@ def test_get_github_import_url() -> None:
|
|||
)
|
||||
|
||||
|
||||
def test_extract_blueprint_from_community_topic(community_post, snapshot) -> None:
|
||||
def test_extract_blueprint_from_community_topic(
|
||||
community_post, snapshot: SnapshotAssertion
|
||||
) -> None:
|
||||
"""Test extracting blueprint."""
|
||||
imported_blueprint = importer._extract_blueprint_from_community_topic(
|
||||
"http://example.com", json.loads(community_post)
|
||||
|
@ -94,7 +97,10 @@ def test_extract_blueprint_from_community_topic_wrong_lang() -> None:
|
|||
|
||||
|
||||
async def test_fetch_blueprint_from_community_url(
|
||||
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker, community_post, snapshot
|
||||
hass: HomeAssistant,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
community_post,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test fetching blueprint from url."""
|
||||
aioclient_mock.get(
|
||||
|
@ -148,7 +154,9 @@ async def test_fetch_blueprint_from_github_url(
|
|||
|
||||
|
||||
async def test_fetch_blueprint_from_github_gist_url(
|
||||
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker, snapshot
|
||||
hass: HomeAssistant,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test fetching blueprint from url."""
|
||||
aioclient_mock.get(
|
||||
|
|
|
@ -502,7 +502,12 @@ async def test_http_processing_intent_conversion_not_expose_new(
|
|||
@pytest.mark.parametrize("sentence", ["turn on kitchen", "turn kitchen on"])
|
||||
@pytest.mark.parametrize("conversation_id", ["my_new_conversation", None])
|
||||
async def test_turn_on_intent(
|
||||
hass: HomeAssistant, init_components, conversation_id, sentence, agent_id, snapshot
|
||||
hass: HomeAssistant,
|
||||
init_components,
|
||||
conversation_id,
|
||||
sentence,
|
||||
agent_id,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test calling the turn on intent."""
|
||||
hass.states.async_set("light.kitchen", "off")
|
||||
|
|
|
@ -4,6 +4,7 @@ from __future__ import annotations
|
|||
|
||||
from unittest.mock import patch
|
||||
|
||||
from syrupy import SnapshotAssertion
|
||||
from wyoming.asr import Transcript
|
||||
|
||||
from homeassistant.components import stt
|
||||
|
@ -29,7 +30,7 @@ async def test_support(hass: HomeAssistant, init_wyoming_stt) -> None:
|
|||
|
||||
|
||||
async def test_streaming_audio(
|
||||
hass: HomeAssistant, init_wyoming_stt, metadata, snapshot
|
||||
hass: HomeAssistant, init_wyoming_stt, metadata, snapshot: SnapshotAssertion
|
||||
) -> None:
|
||||
"""Test streaming audio."""
|
||||
entity = stt.async_get_speech_to_text_entity(hass, "stt.test_asr")
|
||||
|
|
|
@ -7,6 +7,7 @@ from unittest.mock import patch
|
|||
import wave
|
||||
|
||||
import pytest
|
||||
from syrupy import SnapshotAssertion
|
||||
from wyoming.audio import AudioChunk, AudioStop
|
||||
|
||||
from homeassistant.components import tts, wyoming
|
||||
|
@ -38,7 +39,9 @@ async def test_support(hass: HomeAssistant, init_wyoming_tts) -> None:
|
|||
assert not entity.async_get_supported_voices("de-DE")
|
||||
|
||||
|
||||
async def test_get_tts_audio(hass: HomeAssistant, init_wyoming_tts, snapshot) -> None:
|
||||
async def test_get_tts_audio(
|
||||
hass: HomeAssistant, init_wyoming_tts, snapshot: SnapshotAssertion
|
||||
) -> None:
|
||||
"""Test get audio."""
|
||||
audio = bytes(100)
|
||||
audio_events = [
|
||||
|
@ -79,7 +82,7 @@ async def test_get_tts_audio(hass: HomeAssistant, init_wyoming_tts, snapshot) ->
|
|||
|
||||
|
||||
async def test_get_tts_audio_different_formats(
|
||||
hass: HomeAssistant, init_wyoming_tts, snapshot
|
||||
hass: HomeAssistant, init_wyoming_tts, snapshot: SnapshotAssertion
|
||||
) -> None:
|
||||
"""Test changing preferred audio format."""
|
||||
audio = bytes(16000 * 2 * 1) # one second
|
||||
|
@ -190,7 +193,9 @@ async def test_get_tts_audio_audio_oserror(
|
|||
)
|
||||
|
||||
|
||||
async def test_voice_speaker(hass: HomeAssistant, init_wyoming_tts, snapshot) -> None:
|
||||
async def test_voice_speaker(
|
||||
hass: HomeAssistant, init_wyoming_tts, snapshot: SnapshotAssertion
|
||||
) -> None:
|
||||
"""Test using a different voice and speaker."""
|
||||
audio = bytes(100)
|
||||
audio_events = [
|
||||
|
|
Loading…
Reference in New Issue