Skip to content

Commit 1787a57

Browse files
committed
Skip tests for exclude_if for Pydantic less than 2.12
1 parent 3ce28de commit 1787a57

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/test_pydantic/test_field.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import pytest
55
from pydantic import ValidationError
66
from sqlmodel import Field, Session, SQLModel, create_engine
7+
from sqlmodel._compat import PYDANTIC_MINOR_VERSION
78

89

910
def test_decimal():
@@ -177,6 +178,10 @@ class Model(SQLModel):
177178
assert model_schema["properties"]["another_old_field"]["deprecated"] is True
178179

179180

181+
@pytest.mark.skipif(
182+
PYDANTIC_MINOR_VERSION < (2, 12),
183+
reason="exlude_if requires Pydantic 2.12+",
184+
)
180185
def test_exclude_if():
181186
def is_empty_string(value: Any) -> bool:
182187
return value == ""
@@ -197,6 +202,10 @@ class Model(SQLModel):
197202
assert "name" not in dict2
198203

199204

205+
@pytest.mark.skipif(
206+
PYDANTIC_MINOR_VERSION < (2, 12),
207+
reason="exlude_if requires Pydantic 2.12+",
208+
)
200209
def test_exclude_if_via_schema_extra():
201210
def is_empty_string(value: Any) -> bool:
202211
return value == ""

0 commit comments

Comments
 (0)