Stringify enums in selectors (#71441)

This commit is contained in:
Paulus Schoutsen 2022-05-06 11:25:01 -07:00 committed by GitHub
parent 1a00bb9fc4
commit b1a04302b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 18 additions and 15 deletions

View file

@ -1,4 +1,6 @@
"""Test selectors."""
from enum import Enum
import pytest
import voluptuous as vol
@ -52,6 +54,8 @@ def _test_selector(
config = {selector_type: schema}
selector.validate_selector(config)
selector_instance = selector.selector(config)
# We do not allow enums in the config, as they cannot serialize
assert not any(isinstance(val, Enum) for val in selector_instance.config.values())
# Use selector in schema and validate
vol_schema = vol.Schema({"selection": selector_instance})