MCPcopy
hub / github.com/pydantic/pydantic / test_nested_orm

Function test_nested_orm

tests/test_deprecated.py:260–274  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

258
259
260def test_nested_orm():
261 class User(BaseModel):
262 model_config = ConfigDict(from_attributes=True)
263 first_name: str
264 last_name: str
265
266 class State(BaseModel):
267 model_config = ConfigDict(from_attributes=True)
268 user: User
269
270 # Pass an "orm instance"
271 deprecated_from_orm(State, SimpleNamespace(user=SimpleNamespace(first_name='John', last_name='Appleseed')))
272
273 # Pass dictionary data directly
274 State(**{'user': {'first_name': 'John', 'last_name': 'Appleseed'}})
275
276
277def test_parse_raw_pass():

Callers

nothing calls this directly

Calls 2

deprecated_from_ormFunction · 0.85
StateClass · 0.85

Tested by

no test coverage detected