Deprecate const parameter of Field

This commit is contained in:
Yurii Motov
2026-01-29 14:02:17 +01:00
parent 5611bda2e5
commit e87feedb1a
2 changed files with 34 additions and 5 deletions

View File

@@ -54,3 +54,13 @@ def test_repr():
instance = Model(id=123, foo="bar")
assert "foo=" not in repr(instance)
def test_const_is_deprecated():
with pytest.warns(
DeprecationWarning,
match="`const` is deprecated and doesn't work, use `Literal` instead",
):
class Model(SQLModel):
int_value: int = Field(default=10, const=True)