MCPcopy
hub / github.com/pydantic/pydantic / test_parse_obj_as_model

Function test_parse_obj_as_model

tests/test_tools.py:18–25  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16
17
18def test_parse_obj_as_model():
19 class Model(BaseModel):
20 x: int
21 y: bool
22 z: str
23
24 model_inputs = {'x': '1', 'y': 'true', 'z': 'abc'}
25 assert parse_obj_as(Model, model_inputs) == Model(**model_inputs)
26
27
28def test_parse_obj_preserves_subclasses():

Callers

nothing calls this directly

Calls 2

parse_obj_asFunction · 0.90
ModelClass · 0.70

Tested by

no test coverage detected