MCPcopy
hub / github.com/pydantic/pydantic / deprecated_copy

Function deprecated_copy

tests/test_construction.py:112–124  ·  view source on GitHub ↗

This should only be used to make calls to the deprecated `copy` method with arguments that have been removed from `model_copy`. Otherwise, use the `copy_method` fixture below

(m: BaseModel, *, include=None, exclude=None, update=None, deep=False)

Source from the content-addressed store, hash-verified

110
111
112def deprecated_copy(m: BaseModel, *, include=None, exclude=None, update=None, deep=False):
113 """
114 This should only be used to make calls to the deprecated `copy` method with arguments
115 that have been removed from `model_copy`. Otherwise, use the `copy_method` fixture below
116 """
117 with pytest.warns(
118 PydanticDeprecatedSince20,
119 match=(
120 'The `copy` method is deprecated; use `model_copy` instead. '
121 'See the docstring of `BaseModel.copy` for details about how to handle `include` and `exclude`.'
122 ),
123 ):
124 return m.copy(include=include, exclude=exclude, update=update, deep=deep)
125
126
127@pytest.fixture(params=['copy', 'model_copy'])

Callers 8

test_copy_excludeFunction · 0.85
test_copy_includeFunction · 0.85
test_copy_update_excludeFunction · 0.85

Calls 1

copyMethod · 0.45

Tested by

no test coverage detected