From: Yurii Motov Date: Wed, 28 Jan 2026 09:39:25 +0000 (+0100) Subject: Add test for Field `exclude` parameter X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b2c1f53b9b128b7934cbcaf58731656d1979353d;p=thirdparty%2Ffastapi%2Fsqlmodel.git Add test for Field `exclude` parameter --- diff --git a/tests/test_pydantic/test_field.py b/tests/test_pydantic/test_field.py index 140b02fd..68858cf7 100644 --- a/tests/test_pydantic/test_field.py +++ b/tests/test_pydantic/test_field.py @@ -54,3 +54,16 @@ def test_repr(): instance = Model(id=123, foo="bar") assert "foo=" not in repr(instance) + + +def test_exclude(): + class Model(SQLModel): + id: int + name: str + value: int = Field(exclude=True) + + instance = Model(id=1, name="test", value=42) + dict_representation = instance.model_dump() + assert "id" in dict_representation + assert "name" in dict_representation + assert "value" not in dict_representation