MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_noload_issue

Method test_noload_issue

test/orm/test_deprecations.py:2329–2352  ·  view source on GitHub ↗

test #6420. a noload that hits the dynamic loader should have no effect.

(self, type_, user_address_fixture)

Source from the content-addressed store, hash-verified

2327
2328 @testing.combinations(("star",), ("attronly",), argnames="type_")
2329 def test_noload_issue(self, type_, user_address_fixture):
2330 """test #6420. a noload that hits the dynamic loader
2331 should have no effect.
2332
2333 """
2334
2335 User, Address = user_address_fixture()
2336
2337 s = fixture_session()
2338
2339 with expect_noload_deprecation():
2340
2341 if type_ == "star":
2342 u1 = s.query(User).filter_by(id=7).options(noload("*")).first()
2343 assert "name" not in u1.__dict__["name"]
2344 elif type_ == "attronly":
2345 u1 = (
2346 s.query(User)
2347 .filter_by(id=7)
2348 .options(noload(User.addresses))
2349 .first()
2350 )
2351
2352 eq_(u1.__dict__["name"], "jack")
2353
2354
2355class ExpireTest(_fixtures.FixtureTest):

Callers

nothing calls this directly

Calls 8

fixture_sessionFunction · 0.90
noloadFunction · 0.90
eq_Function · 0.90
firstMethod · 0.45
optionsMethod · 0.45
filter_byMethod · 0.45
queryMethod · 0.45

Tested by

no test coverage detected