mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Fix pico tts errors (#41619)
Enabled the use of mutagen in unit tests. Added a test for tagging a minimal .wav file.
This commit is contained in:
@@ -73,7 +73,7 @@ def empty_cache_dir(tmp_path, mock_init_cache_dir, mock_get_cache_files, request
|
||||
assert False
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
@pytest.fixture()
|
||||
def mutagen_mock():
|
||||
"""Mock writing tags."""
|
||||
with patch(
|
||||
@@ -480,7 +480,7 @@ async def test_setup_component_and_test_service_with_receive_voice(
|
||||
"42f18378fd4393d18c8dd11d03fa9563c1e54491_en_-_demo.mp3",
|
||||
demo_data,
|
||||
demo_provider,
|
||||
"AI person is in front of your door.",
|
||||
"There is someone at the door.",
|
||||
"en",
|
||||
None,
|
||||
)
|
||||
@@ -716,3 +716,24 @@ async def test_setup_component_and_web_get_url_bad_config(hass, hass_client):
|
||||
|
||||
req = await client.post(url, json=data)
|
||||
assert req.status == 400
|
||||
|
||||
|
||||
async def test_tags_with_wave(hass, demo_provider):
|
||||
"""Set up the demo platform and call service and receive voice."""
|
||||
|
||||
# below data represents an empty wav file
|
||||
demo_data = bytes.fromhex(
|
||||
"52 49 46 46 24 00 00 00 57 41 56 45 66 6d 74 20 10 00 00 00 01 00 02 00"
|
||||
+ "22 56 00 00 88 58 01 00 04 00 10 00 64 61 74 61 00 00 00 00"
|
||||
)
|
||||
|
||||
tagged_data = tts.SpeechManager.write_tags(
|
||||
"42f18378fd4393d18c8dd11d03fa9563c1e54491_en_-_demo.wav",
|
||||
demo_data,
|
||||
demo_provider,
|
||||
"AI person is in front of your door.",
|
||||
"en",
|
||||
None,
|
||||
)
|
||||
|
||||
assert tagged_data != demo_data
|
||||
|
||||
Reference in New Issue
Block a user