MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / test_session_bind

Method test_session_bind

test/orm/test_bind.py:635–651  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

633 cls.mapper_registry.map_imperatively(Foo, meta.tables["test_table"])
634
635 def test_session_bind(self):
636 Foo = self.classes.Foo
637
638 engine = testing.db
639
640 for bind in (engine, engine.connect()):
641 try:
642 sess = Session(bind=bind)
643 assert sess.bind is bind
644 f = Foo()
645 sess.add(f)
646 sess.flush()
647 assert sess.get(Foo, f.id) is f
648 finally:
649 if hasattr(bind, "close"):
650 bind.close()
651 sess.close()
652
653 def test_session_unbound(self):
654 Foo = self.classes.Foo

Callers

nothing calls this directly

Calls 8

addMethod · 0.95
flushMethod · 0.95
getMethod · 0.95
closeMethod · 0.95
SessionClass · 0.90
FooClass · 0.70
connectMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected