mirror of
https://github.com/fastapi/sqlmodel.git
synced 2026-03-13 09:29:54 +08:00
Deprecate const parameter of Field
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user