Coverage for tests/test_enums_models.py: 100%

17 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2024-09-09 00:02 +0000

1import enum 1abcdefghijklmnopqr

2import uuid 1abcdefghijklmnopqr

3 

4from sqlmodel import Field, SQLModel 1abcdefghijklmnopqr

5 

6 

7class MyEnum1(str, enum.Enum): 1abcdefghijklmnopqr

8 A = "A" 1abcdefghijklmnopqr

9 B = "B" 1abcdefghijklmnopqr

10 

11 

12class MyEnum2(str, enum.Enum): 1abcdefghijklmnopqr

13 C = "C" 1abcdefghijklmnopqr

14 D = "D" 1abcdefghijklmnopqr

15 

16 

17class BaseModel(SQLModel): 1abcdefghijklmnopqr

18 id: uuid.UUID = Field(primary_key=True) 1abcdefghijklmnopqr

19 enum_field: MyEnum2 1abcdefghijklmnopqr

20 

21 

22class FlatModel(SQLModel, table=True): 1abcdefghijklmnopqr

23 id: uuid.UUID = Field(primary_key=True) 1abcdefghijklmnopqr

24 enum_field: MyEnum1 1abcdefghijklmnopqr

25 

26 

27class InheritModel(BaseModel, table=True): 1abcdefghijklmnopqr

28 pass 1abcdefghijklmnopqr