MCPcopy
hub / github.com/pydantic/pydantic / test_copy_include_exclude

Function test_copy_include_exclude

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

Source from the content-addressed store, hash-verified

206
207@pytest.mark.thread_unsafe(reason='`pytest.warns()` is thread unsafe')
208def test_copy_include_exclude(ModelTwo):
209 m = ModelTwo(a=24, d=Model(a='12'))
210 m2 = deprecated_copy(m, include={'a', 'b', 'c'}, exclude={'c'})
211
212 assert set(m.model_dump().keys()) == {'a', 'b', 'c', 'd'}
213 assert set(m2.model_dump().keys()) == {'a', 'b'}
214
215
216@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