def test_multi_select_in_serializer(): """Test multi_select with custom_serializer.""" assert cv.custom_serializer(cv.multi_select({"paulus": "Paulus"})) == { "type": "multi_select", "options": { "paulus": "Paulus" }, }
def custom_serializer(schema: Any) -> Any: """Serialize additional types for voluptuous_serialize.""" if schema is cv_boolean: return {"type": "bool"} if schema is vol.Schema: return voluptuous_serialize.convert( schema, custom_serializer=custom_serializer) return cv.custom_serializer(schema)
def test_positive_time_period_dict_in_serializer(): """Test positive_time_period_dict with custom_serializer.""" assert cv.custom_serializer(cv.positive_time_period_dict) == { "type": "positive_time_period_dict", }
def test_string_in_serializer(): """Test string with custom_serializer.""" assert cv.custom_serializer(cv.string) == { "type": "string", }
def test_boolean_in_serializer(): """Test boolean with custom_serializer.""" assert cv.custom_serializer(cv.boolean) == { "type": "boolean", }