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