Coverage for tests / test_missing_type.py: 92%

13 statements  

« prev     ^ index     » next       coverage.py v7.13.0, created at 2026-01-06 21:09 +0000

1from typing import Optional 1jklmnopqr

2 

3import pytest 1jklmnopqr

4from pydantic import BaseModel 1jklmnopqr

5from sqlmodel import Field, SQLModel 1jklmnopqr

6 

7 

8def test_missing_sql_type(): 1jklmnopqr

9 class CustomType(BaseModel): 1abcdefghi

10 @classmethod 1abcdefghi

11 def __get_validators__(cls): 1abcdefghi

12 yield cls.validate 

13 

14 @classmethod 1abcdefghi

15 def validate(cls, v): # pragma: no cover 1abcdefghi

16 return v 

17 

18 with pytest.raises(ValueError): 1abcdefghi

19 

20 class Item(SQLModel, table=True): 1abcdefghi

21 id: Optional[int] = Field(default=None, primary_key=True) 1abcdefghi

22 item: CustomType 1abcdefghi