(self)
| 2687 | self._test_class_guards(early, is_class=False) |
| 2688 | |
| 2689 | def test_refresh_arg_signature(self): |
| 2690 | class Mapped: |
| 2691 | pass |
| 2692 | |
| 2693 | self._map_it(Mapped) |
| 2694 | |
| 2695 | m1 = Mapped() |
| 2696 | s = fixture_session() |
| 2697 | |
| 2698 | with mock.patch.object(s, "_validate_persistent"): |
| 2699 | assert_raises_message( |
| 2700 | exc.ArgumentError, |
| 2701 | "with_for_update should be the boolean value True, " |
| 2702 | "or a dictionary with options", |
| 2703 | s.refresh, |
| 2704 | m1, |
| 2705 | with_for_update={}, |
| 2706 | ) |
| 2707 | |
| 2708 | with mock.patch( |
| 2709 | "sqlalchemy.orm.session.loading._load_on_ident" |
| 2710 | ) as load_on_ident: |
| 2711 | s.refresh(m1, with_for_update={"read": True}) |
| 2712 | s.refresh(m1, with_for_update=True) |
| 2713 | s.refresh(m1, with_for_update=False) |
| 2714 | s.refresh(m1) |
| 2715 | |
| 2716 | from sqlalchemy.orm.query import ForUpdateArg |
| 2717 | |
| 2718 | eq_( |
| 2719 | [ |
| 2720 | call[-1]["with_for_update"] |
| 2721 | for call in load_on_ident.mock_calls |
| 2722 | ], |
| 2723 | [ForUpdateArg(read=True), ForUpdateArg(), None, None], |
| 2724 | ) |
| 2725 | |
| 2726 | |
| 2727 | class NewStyleExecutionTest(_fixtures.FixtureTest): |
nothing calls this directly
no test coverage detected