MCPcopy
hub / github.com/pydantic/pydantic / deprecated_from_orm

Function deprecated_from_orm

tests/test_deprecated.py:40–48  ·  view source on GitHub ↗
(model_type: type[BaseModel], obj: Any)

Source from the content-addressed store, hash-verified

38
39
40def deprecated_from_orm(model_type: type[BaseModel], obj: Any) -> Any:
41 with pytest.warns(
42 PydanticDeprecatedSince20,
43 match=re.escape(
44 "The `from_orm` method is deprecated; set `model_config['from_attributes']=True` "
45 'and use `model_validate` instead.'
46 ),
47 ):
48 return model_type.from_orm(obj)
49
50
51def test_from_attributes_root():

Callers 8

test_from_attributesFunction · 0.85
test_not_from_attributesFunction · 0.85
test_object_with_getattrFunction · 0.85
test_propertiesFunction · 0.85
test_root_validatorFunction · 0.85
test_nested_ormFunction · 0.85

Calls 1

from_ormMethod · 0.45

Tested by

no test coverage detected