(self, user_arg, is_class=True)
| 2602 | ) |
| 2603 | |
| 2604 | def _test_class_guards(self, user_arg, is_class=True): |
| 2605 | watchdog = set() |
| 2606 | |
| 2607 | def raises_(method, *args, **kw): |
| 2608 | watchdog.add(method) |
| 2609 | callable_ = getattr( |
| 2610 | Session(), |
| 2611 | method, |
| 2612 | ) |
| 2613 | if is_class: |
| 2614 | assert_raises( |
| 2615 | sa.orm.exc.UnmappedClassError, callable_, *args, **kw |
| 2616 | ) |
| 2617 | else: |
| 2618 | assert_raises( |
| 2619 | exc.NoInspectionAvailable, callable_, *args, **kw |
| 2620 | ) |
| 2621 | |
| 2622 | raises_("connection", bind_arguments=dict(mapper=user_arg)) |
| 2623 | |
| 2624 | raises_( |
| 2625 | "execute", text("SELECT 1"), bind_arguments=dict(mapper=user_arg) |
| 2626 | ) |
| 2627 | |
| 2628 | raises_("get_bind", mapper=user_arg) |
| 2629 | |
| 2630 | raises_( |
| 2631 | "scalar", text("SELECT 1"), bind_arguments=dict(mapper=user_arg) |
| 2632 | ) |
| 2633 | |
| 2634 | raises_( |
| 2635 | "scalars", text("SELECT 1"), bind_arguments=dict(mapper=user_arg) |
| 2636 | ) |
| 2637 | |
| 2638 | eq_( |
| 2639 | watchdog, |
| 2640 | self._class_methods, |
| 2641 | watchdog.symmetric_difference(self._class_methods), |
| 2642 | ) |
| 2643 | |
| 2644 | def test_join_transaction_mode(self): |
| 2645 | with expect_raises_message( |
no test coverage detected