Skip to content

Commit b751599

Browse files
committed
add ignores for mypy
1 parent cd7546c commit b751599

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

sqlmodel/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ def __init__(
685685
table = getattr(cls, "__table__", None)
686686
if table is not None:
687687
# Attach Literal-based value constraints at the database level
688-
for field_name, field in get_model_fields(cls).items():
688+
for field_name, field in get_model_fields(cls).items(): # type: ignore
689689
annotation = getattr(field, "annotation", None)
690690
literal_info = get_literal_annotation_info(annotation)
691691
if literal_info is None:
@@ -700,7 +700,7 @@ def __init__(
700700
elif base_type is bool:
701701
coerced_values = tuple(bool(v) for v in values)
702702
else:
703-
coerced_values = tuple(str(v) for v in values)
703+
coerced_values = tuple(str(v) for v in values) # type: ignore
704704
constraint_name = f"ck_{table.name}_{field_name}_literal"
705705
constraint = CheckConstraint(
706706
column.in_(coerced_values),

tests/test_main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Annotated, Literal, Union
1+
from typing import Annotated, Literal
22

33
import pytest
44
from sqlalchemy import text
@@ -332,7 +332,7 @@ def test_literal_optional_and_union_constraints(clear_sqlmodel):
332332
class Model(SQLModel, table=True):
333333
id: int | None = Field(default=None, primary_key=True)
334334
opt_str: Literal["x", "y"] | None = None
335-
union_int: Union[Literal[10, 20], None] = None
335+
union_int: Literal[10, 20] | None = None
336336

337337
engine = create_engine("sqlite://")
338338
SQLModel.metadata.create_all(engine)

0 commit comments

Comments
 (0)