(self)
| 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 |