MCPcopy
hub / github.com/pydantic/pydantic / test_copy_set_fields

Function test_copy_set_fields

tests/test_construction.py:324–329  ·  view source on GitHub ↗
(ModelTwo, copy_method)

Source from the content-addressed store, hash-verified

322
323
324def test_copy_set_fields(ModelTwo, copy_method):
325 m = ModelTwo(a=24, d=Model(a='12'))
326 m2 = copy_method(m)
327
328 assert m.model_dump(exclude_unset=True) == {'a': 24.0, 'd': {'a': 12}}
329 assert m.model_dump(exclude_unset=True) == m2.model_dump(exclude_unset=True)
330
331
332def test_simple_pickle():

Callers

nothing calls this directly

Calls 4

copy_methodFunction · 0.85
ModelTwoClass · 0.70
ModelClass · 0.70
model_dumpMethod · 0.45

Tested by

no test coverage detected