MCPcopy
hub / github.com/pydantic/pydantic / test_forward_ref_in_generic

Function test_forward_ref_in_generic

tests/test_forward_ref.py:1034–1050  ·  view source on GitHub ↗

https://github.com/pydantic/pydantic/issues/6503

(create_module: Any)

Source from the content-addressed store, hash-verified

1032
1033
1034def test_forward_ref_in_generic(create_module: Any) -> None:
1035 """https://github.com/pydantic/pydantic/issues/6503"""
1036
1037 @create_module
1038 def module():
1039 from pydantic import BaseModel
1040
1041 class Foo(BaseModel):
1042 x: dict['type[Bar]', type['Bar']]
1043
1044 class Bar(BaseModel):
1045 pass
1046
1047 Foo = module.Foo
1048 Bar = module.Bar
1049
1050 assert Foo(x={Bar: Bar}).x[Bar] is Bar
1051
1052
1053def test_forward_ref_in_generic_separate_modules(create_module: Any) -> None:

Callers

nothing calls this directly

Calls 1

FooClass · 0.70

Tested by

no test coverage detected