MCPcopy
hub / github.com/pydantic/pydantic / test_dunder_copy

Function test_dunder_copy

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

Source from the content-addressed store, hash-verified

505
506
507def test_dunder_copy(ModelTwo):
508 m = ModelTwo(a=24, d=Model(a='12'))
509 m2 = m.__copy__()
510 assert m is not m2
511
512 assert m.a == m2.a == 24
513 assert isinstance(m2.d, Model)
514 assert m.d is m2.d
515 assert m.d.a == m2.d.a == 12
516
517 m.a = 12
518 assert m.a != m2.a
519
520
521def test_dunder_deepcopy(ModelTwo):

Callers

nothing calls this directly

Calls 3

ModelTwoClass · 0.70
ModelClass · 0.70
__copy__Method · 0.45

Tested by

no test coverage detected