def test_param_schema_implicit(): spec = load_spec( dict( id_name="googlesheets", name="x", category="Clean", parameters=[ {"id_name": "foo", "type": "string", "default": "X"}, { "id_name": "bar", "type": "secret", "secret_logic": {"provider": "oauth2", "service": "google"}, }, { "id_name": "baz", "type": "menu", "options": [ {"value": "a", "label": "A"}, "separator", {"value": "c", "label": "C"}, ], "default": "c", }, ], ) ) assert spec.param_schema == ParamSchema.Dict( { "foo": ParamSchema.String(default="X"), # secret is not in param_schema "baz": ParamSchema.Enum(choices=frozenset({"a", "c"}), default="c"), } )
def test_validate_not_ok(self): with pytest.raises(ValueError, match="not in choices"): S.Enum(choices=frozenset(["foo", "bar"]), default="foo").validate("baz")
def test_validate_ok(self): S.Enum(choices=frozenset(["foo", "bar"]), default="foo").validate("bar")