MCPcopy
hub / github.com/pydantic/pydantic / test_dunder_deepcopy

Function test_dunder_deepcopy

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

Source from the content-addressed store, hash-verified

519
520
521def test_dunder_deepcopy(ModelTwo):
522 m = ModelTwo(a=24, d=Model(a='12'))
523 m2 = m.__copy__()
524 assert m is not m2
525
526 assert m.a == m2.a == 24
527 assert isinstance(m2.d, Model)
528 assert m.d is m2.d
529 assert m.d.a == m2.d.a == 12
530
531 m.a = 12
532 assert m.a != m2.a
533
534
535def test_model_copy(ModelTwo):

Callers

nothing calls this directly

Calls 3

ModelTwoClass · 0.70
ModelClass · 0.70
__copy__Method · 0.45

Tested by

no test coverage detected