Coverage for tests / test_missing_type.py: 92%
12 statements
« prev ^ index » next coverage.py v7.13.0, created at 2026-11-09 00:02 +0000
« prev ^ index » next coverage.py v7.13.0, created at 2026-11-09 00:02 +0000
1import pytest 1jklmnopqr
2from pydantic import BaseModel 1jklmnopqr
3from sqlmodel import Field, SQLModel 1jklmnopqr
6def test_missing_sql_type(): 1jklmnopqr
7 class CustomType(BaseModel): 1abcdefghi
8 @classmethod 1abcdefghi
9 def __get_validators__(cls): 1abcdefghi
10 yield cls.validate
12 @classmethod 1abcdefghi
13 def validate(cls, v): # pragma: no cover 1abcdefghi
14 return v
16 with pytest.raises(ValueError): 1abcdefghi
18 class Item(SQLModel, table=True): 1abcdefghi
19 id: int | None = Field(default=None, primary_key=True) 1abcdefghi
20 item: CustomType 1abcdefghi