MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_lazyload

Method test_lazyload

test/orm/test_ac_relationships.py:262–279  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

260 sess.commit()
261
262 def test_lazyload(self):
263 A, B = self.classes("A", "B")
264
265 sess = fixture_session()
266 a1 = sess.query(A).first()
267
268 with self.sql_execution_asserter() as asserter:
269 # note this is many-to-one. use_get is unconditionally turned
270 # off for relationship to aliased class for now.
271 eq_(a1.b, B(id=1))
272
273 asserter.assert_(
274 CompiledSQL(
275 "SELECT b.id FROM b JOIN d ON d.b_id = b.id "
276 "JOIN c ON c.id = d.c_id WHERE :param_1 = b.id",
277 [{"param_1": 1}],
278 )
279 )
280
281 def test_joinedload(self):
282 A, B = self.classes("A", "B")

Callers

nothing calls this directly

Calls 8

fixture_sessionFunction · 0.90
eq_Function · 0.90
CompiledSQLClass · 0.90
BClass · 0.70
firstMethod · 0.45
queryMethod · 0.45
assert_Method · 0.45

Tested by

no test coverage detected