MCPcopy
hub / github.com/pydantic/pydantic / test_copy_include

Function test_copy_include

tests/test_construction.py:196–204  ·  view source on GitHub ↗
(ModelTwo)

Source from the content-addressed store, hash-verified

194
195@pytest.mark.thread_unsafe(reason='`pytest.warns()` is thread unsafe')
196def test_copy_include(ModelTwo):
197 m = ModelTwo(a=24, d=Model(a='12'))
198 m2 = deprecated_copy(m, include={'a'})
199
200 assert m.a == m2.a == 24
201 assert set(m.model_dump().keys()) == {'a', 'b', 'c', 'd'}
202 assert set(m2.model_dump().keys()) == {'a'}
203
204 assert m != m2
205
206
207@pytest.mark.thread_unsafe(reason='`pytest.warns()` is thread unsafe')

Callers

nothing calls this directly

Calls 5

deprecated_copyFunction · 0.85
keysMethod · 0.80
ModelTwoClass · 0.70
ModelClass · 0.70
model_dumpMethod · 0.45

Tested by

no test coverage detected