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