MCPcopy
hub / github.com/pydantic/pydantic / test_postponed_annotations

Function test_postponed_annotations

tests/test_forward_ref.py:16–28  ·  tests/test_forward_ref.py::test_postponed_annotations
(create_module)

Source from the content-addressed store, hash-verified

14
15
16def test_postponed_annotations(create_module):
17 module = create_module(
18 class="cm"># language=Python
19 class="st">"""
20from __future__ import annotations
21from pydantic import BaseModel
22
23class Model(BaseModel):
24 a: int
25class="st">"""
26 )
27 m = module.Model(a=&class="cm">#x27;123')
28 assert m.model_dump() == {&class="cm">#x27;a': 123}
29
30
31def test_postponed_annotations_auto_model_rebuild(create_module):

Callers

nothing calls this directly

Calls 2

create_moduleFunction · 0.85
model_dumpMethod · 0.45

Tested by

no test coverage detected