(self)
| 2284 | self._test_class_guards(early, is_class=False) |
| 2285 | |
| 2286 | def test_refresh_arg_signature(self): |
| 2287 | class Mapped: |
| 2288 | pass |
| 2289 | |
| 2290 | self._map_it(Mapped) |
| 2291 | |
| 2292 | m1 = Mapped() |
| 2293 | s = fixture_session() |
| 2294 | |
| 2295 | with mock.patch.object(s, "_validate_persistent"): |
| 2296 | assert_raises_message( |
| 2297 | exc.ArgumentError, |
| 2298 | "with_for_update should be the boolean value True, " |
| 2299 | "or a dictionary with options", |
| 2300 | s.refresh, |
| 2301 | m1, |
| 2302 | with_for_update={}, |
| 2303 | ) |
| 2304 | |
| 2305 | with mock.patch( |
| 2306 | "sqlalchemy.orm.session.loading.load_on_ident" |
| 2307 | ) as load_on_ident: |
| 2308 | s.refresh(m1, with_for_update={"read": True}) |
| 2309 | s.refresh(m1, with_for_update=True) |
| 2310 | s.refresh(m1, with_for_update=False) |
| 2311 | s.refresh(m1) |
| 2312 | |
| 2313 | from sqlalchemy.orm.query import ForUpdateArg |
| 2314 | |
| 2315 | eq_( |
| 2316 | [ |
| 2317 | call[-1]["with_for_update"] |
| 2318 | for call in load_on_ident.mock_calls |
| 2319 | ], |
| 2320 | [ForUpdateArg(read=True), ForUpdateArg(), None, None], |
| 2321 | ) |
| 2322 | |
| 2323 | |
| 2324 | class NewStyleExecutionTest(_fixtures.FixtureTest): |
nothing calls this directly
no test coverage detected