MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_copy

Method test_copy

test/ext/test_associationproxy.py:1541–1553  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1539 assert set(p.kids) == {"c1", "c2"}, p.kids
1540
1541 def test_copy(self):
1542 self.mapper_registry.map_imperatively(
1543 Parent,
1544 self.tables.parents,
1545 properties=dict(children=relationship(Child)),
1546 )
1547 self.mapper_registry.map_imperatively(Child, self.tables.children)
1548 p = Parent("p1")
1549 p.kids.extend(["c1", "c2"])
1550 p_copy = copy.copy(p)
1551 del p
1552 gc_collect()
1553 assert set(p_copy.kids) == {"c1", "c2"}, p_copy.kids
1554
1555 def test_pickle_list(self):
1556 self.mapper_registry.map_imperatively(

Callers

nothing calls this directly

Calls 5

relationshipFunction · 0.90
map_imperativelyMethod · 0.80
ParentClass · 0.70
extendMethod · 0.45
copyMethod · 0.45

Tested by

no test coverage detected