Test VA compat function

This commit is contained in:
Jesse Hills 2024-04-04 18:08:51 +13:00
parent ca122e0610
commit e72891e3cf
No known key found for this signature in database
GPG Key ID: BEAAE804EFD8E83A
1 changed files with 19 additions and 0 deletions

View File

@ -105,6 +105,7 @@ from aioesphomeapi.model import (
UserService,
UserServiceArg,
UserServiceArgType,
VoiceAssistantFeature,
build_unique_id,
converter_field,
)
@ -432,6 +433,24 @@ def test_bluetooth_backcompat_for_device_info(
assert info.bluetooth_proxy_feature_flags_compat(APIVersion(1, 9)) == 42
# Add va compat test
@pytest.mark.parametrize(
("version", "flags"),
[
(1, VoiceAssistantFeature.VOICE_ASSISTANT),
(2, VoiceAssistantFeature.VOICE_ASSISTANT | VoiceAssistantFeature.SPEAKER),
],
)
def test_voice_assistant_backcompat_for_device_info(
version: int, flags: VoiceAssistantFeature
) -> None:
info = DeviceInfo(
legacy_voice_assistant_version=version, voice_assistant_feature_flags=42
)
assert info.voice_assistant_feature_flags_compat(APIVersion(1, 9)) is flags
assert info.voice_assistant_feature_flags_compat(APIVersion(1, 10)) == 42
@pytest.mark.parametrize(
(
"legacy_supports_brightness",