Skip to content

Commit 47a5e94

Browse files
committed
Add test to catch bug
1 parent 1569764 commit 47a5e94

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/test_registry.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,20 @@ def test_register_object_field_and_get_for_graphene_field():
5858
field = r.get_object_field_for_graphene_field(GraphFoo, "name")
5959
assert field is not None
6060
assert field.annotation == str
61+
62+
63+
def test_register_object_field_nested_model():
64+
"""https://github.com/graphql-python/graphene-pydantic/issues/104"""
65+
66+
class A(BaseModel):
67+
x: str | None = None
68+
y: list["A"] | None = None
69+
70+
class P_A(PydanticInputObjectType):
71+
class Meta:
72+
model = A
73+
74+
try:
75+
P_A.resolve_placeholders()
76+
except TypeError as e:
77+
assert False, f"'10 / 5' raised an exception: {e}"

0 commit comments

Comments
 (0)