From b2c1f53b9b128b7934cbcaf58731656d1979353d Mon Sep 17 00:00:00 2001 From: Yurii Motov Date: Wed, 28 Jan 2026 10:39:25 +0100 Subject: [PATCH] Add test for Field `exclude` parameter --- tests/test_pydantic/test_field.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 -- 2.47.3