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

Method test_basic

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

Source from the content-addressed store, hash-verified

1591 assert not m.configured
1592
1593 def test_basic(self):
1594 User, users = self.classes.User, self.tables.users
1595
1596 self.mapper_registry.map_imperatively(User, users)
1597 canary = self.listen_all(User)
1598 named_canary = self.listen_all(User, named=True)
1599
1600 sess = fixture_session()
1601 u = User(name="u1")
1602 sess.add(u)
1603 sess.flush()
1604 sess.expire(u)
1605 u = sess.get(User, u.id)
1606 sess.expunge_all()
1607 u = sess.get(User, u.id)
1608 u.name = "u1 changed"
1609 sess.flush()
1610 sess.delete(u)
1611 sess.flush()
1612 expected = [
1613 "init",
1614 "before_insert",
1615 "refresh_flush",
1616 "after_insert",
1617 "expire",
1618 "refresh",
1619 "load",
1620 "before_update",
1621 "refresh_flush",
1622 "after_update",
1623 "before_delete",
1624 "after_delete",
1625 ]
1626 eq_(canary, expected)
1627 eq_(named_canary, expected)
1628
1629 def test_insert_before_configured(self):
1630 users, User = self.tables.users, self.classes.User

Callers

nothing calls this directly

Calls 11

listen_allMethod · 0.95
fixture_sessionFunction · 0.90
eq_Function · 0.90
map_imperativelyMethod · 0.80
UserClass · 0.70
addMethod · 0.45
flushMethod · 0.45
expireMethod · 0.45
getMethod · 0.45
expunge_allMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected