Skip to content

Commit a801312

Browse files
committed
Mark test as requiring pydantic v2
1 parent d49fd6f commit a801312

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/test_attribute_keyed_dict.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
from sqlalchemy.orm.collections import attribute_keyed_dict
88
from sqlmodel import Field, Relationship, Session, SQLModel, create_engine
99

10+
from tests.conftest import needs_pydanticv2
11+
1012

1113
def test_attribute_keyed_dict_works(clear_sqlmodel):
1214
class Color(str, Enum):
@@ -48,9 +50,11 @@ class Parent(SQLModel, table=True):
4850
assert parent.children_by_color[Color.Blue].value == 2
4951

5052

51-
# typing.Dict throws if it receives the wrong number of type arguments, but
52-
# dict (3.10+) does not.
53+
# typing.Dict throws if it receives the wrong number of type arguments, but dict
54+
# (3.10+) does not; and Pydantic v1 fails to process models with dicts with no
55+
# type arguments.
5356
@pytest.mark.skipif(sys.version_info < (3, 10), reason="dict is not subscriptable")
57+
@needs_pydanticv2
5458
def test_dict_relationship_throws_on_missing_annotation_arg(clear_sqlmodel):
5559
class Color(str, Enum):
5660
Orange = "Orange"

0 commit comments

Comments
 (0)