✅ Refactor test_enums to make them independent of previous imports (#1095)
This commit is contained in:
committed by
GitHub
parent
9acd934c7f
commit
e4f3ec7a80
28
tests/test_enums_models.py
Normal file
28
tests/test_enums_models.py
Normal file
@@ -0,0 +1,28 @@
|
||||
import enum
|
||||
import uuid
|
||||
|
||||
from sqlmodel import Field, SQLModel
|
||||
|
||||
|
||||
class MyEnum1(str, enum.Enum):
|
||||
A = "A"
|
||||
B = "B"
|
||||
|
||||
|
||||
class MyEnum2(str, enum.Enum):
|
||||
C = "C"
|
||||
D = "D"
|
||||
|
||||
|
||||
class BaseModel(SQLModel):
|
||||
id: uuid.UUID = Field(primary_key=True)
|
||||
enum_field: MyEnum2
|
||||
|
||||
|
||||
class FlatModel(SQLModel, table=True):
|
||||
id: uuid.UUID = Field(primary_key=True)
|
||||
enum_field: MyEnum1
|
||||
|
||||
|
||||
class InheritModel(BaseModel, table=True):
|
||||
pass
|
||||
Reference in New Issue
Block a user