test #6420. a noload that hits the dynamic loader should have no effect.
(self, type_, user_address_fixture)
| 2295 | |
| 2296 | @testing.combinations(("star",), ("attronly",), argnames="type_") |
| 2297 | def test_noload_issue(self, type_, user_address_fixture): |
| 2298 | """test #6420. a noload that hits the dynamic loader |
| 2299 | should have no effect. |
| 2300 | |
| 2301 | """ |
| 2302 | |
| 2303 | User, Address = user_address_fixture() |
| 2304 | |
| 2305 | s = fixture_session() |
| 2306 | |
| 2307 | with expect_noload_deprecation(): |
| 2308 | |
| 2309 | if type_ == "star": |
| 2310 | u1 = s.query(User).filter_by(id=7).options(noload("*")).first() |
| 2311 | assert "name" not in u1.__dict__["name"] |
| 2312 | elif type_ == "attronly": |
| 2313 | u1 = ( |
| 2314 | s.query(User) |
| 2315 | .filter_by(id=7) |
| 2316 | .options(noload(User.addresses)) |
| 2317 | .first() |
| 2318 | ) |
| 2319 | |
| 2320 | eq_(u1.__dict__["name"], "jack") |
| 2321 | |
| 2322 | # noload doesn't affect a dynamic loader, because it has no state |
| 2323 | eq_(list(u1.addresses), [Address(id=1)]) |
| 2324 | |
| 2325 | |
| 2326 | class WriteOnlyTest(_WriteOnlyFixture, _fixtures.FixtureTest): |
nothing calls this directly
no test coverage detected