MCPcopy Index your code
hub / github.com/sqlalchemy/sqlalchemy / test_merge

Method test_merge

test/orm/test_events.py:1681–1703  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1679 )
1680
1681 def test_merge(self):
1682 users, User = self.tables.users, self.classes.User
1683
1684 self.mapper_registry.map_imperatively(User, users)
1685
1686 canary = []
1687
1688 def load(obj, ctx):
1689 canary.append("load")
1690
1691 event.listen(Mapper, "load", load)
1692
1693 s = fixture_session()
1694 u = User(name="u1")
1695 s.add(u)
1696 s.commit()
1697 s = fixture_session()
1698 u2 = s.merge(u)
1699 s = fixture_session()
1700 u2 = s.merge(User(name="u2")) # noqa
1701 s.commit()
1702 s.query(User).order_by(User.id).first()
1703 eq_(canary, ["load", "load", "load"])
1704
1705 def test_inheritance(self):
1706 users, addresses, User = (

Callers

nothing calls this directly

Calls 11

fixture_sessionFunction · 0.90
eq_Function · 0.90
map_imperativelyMethod · 0.80
UserClass · 0.70
listenMethod · 0.45
addMethod · 0.45
commitMethod · 0.45
mergeMethod · 0.45
firstMethod · 0.45
order_byMethod · 0.45
queryMethod · 0.45

Tested by

no test coverage detected