MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_session_bind

Method test_session_bind

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

Source from the content-addressed store, hash-verified

639 cls.mapper_registry.map_imperatively(Foo, meta.tables["test_table"])
640
641 def test_session_bind(self):
642 Foo = self.classes.Foo
643
644 engine = testing.db
645
646 for bind in (engine, engine.connect()):
647 try:
648 sess = Session(bind=bind)
649 assert sess.bind is bind
650 f = Foo()
651 sess.add(f)
652 sess.flush()
653 assert sess.get(Foo, f.id) is f
654 finally:
655 if hasattr(bind, "close"):
656 bind.close()
657 sess.close()
658
659 def test_session_unbound(self):
660 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