MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_m2o_joinedload_not_others

Method test_m2o_joinedload_not_others

test/orm/test_query.py:5640–5655  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

5638 assert "addresses" not in obj.__dict__
5639
5640 def test_m2o_joinedload_not_others(self):
5641 self._eagerload_mappings(addresses_lazy="joined")
5642 Address = self.classes.Address
5643 sess = fixture_session()
5644 q = (
5645 sess.query(Address)
5646 .options(lazyload("*"), joinedload(Address.user))
5647 .yield_per(1)
5648 .filter_by(id=1)
5649 )
5650
5651 def go():
5652 result = q.all()
5653 assert result[0].user
5654
5655 self.assert_sql_count(testing.db, go, 1)
5656
5657 def test_no_unique_w_yield_per(self):
5658 self._eagerload_mappings()

Callers

nothing calls this directly

Calls 9

_eagerload_mappingsMethod · 0.95
fixture_sessionFunction · 0.90
lazyloadFunction · 0.90
joinedloadFunction · 0.90
assert_sql_countMethod · 0.80
filter_byMethod · 0.45
yield_perMethod · 0.45
optionsMethod · 0.45
queryMethod · 0.45

Tested by

no test coverage detected