Coverage for tests/test_missing_type.py: 100%
13 statements
« prev ^ index » next coverage.py v7.11.0, created at 2025-10-27 00:03 +0000
« prev ^ index » next coverage.py v7.11.0, created at 2025-10-27 00:03 +0000
1from typing import Optional 1klmnopqrst
3import pytest 1klmnopqrst
4from pydantic import BaseModel 1klmnopqrst
5from sqlmodel import Field, SQLModel 1klmnopqrst
8def test_missing_sql_type(): 1klmnopqrst
9 class CustomType(BaseModel): 1abefcgdhij
10 @classmethod 1abefcgdhij
11 def __get_validators__(cls): 1abefcgdhij
12 yield cls.validate 1abcd
14 @classmethod 1abefcgdhij
15 def validate(cls, v): # pragma: no cover 1abefcgdhij
16 return v
18 with pytest.raises(ValueError): 1abefcgdhij
20 class Item(SQLModel, table=True): 1abefcgdhij
21 id: Optional[int] = Field(default=None, primary_key=True) 1abefcgdhij
22 item: CustomType 1abefcgdhij