MCPcopy Create free account
hub / github.com/zzzeek/sqlalchemy / test_eager_options_with_limit

Method test_eager_options_with_limit

test/orm/test_options.py:1599–1635  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1597 self.sql_count_(0, go)
1598
1599 def test_eager_options_with_limit(self):
1600 Address, addresses, users, User = (
1601 self.classes.Address,
1602 self.tables.addresses,
1603 self.tables.users,
1604 self.classes.User,
1605 )
1606
1607 self.mapper_registry.map_imperatively(
1608 User,
1609 users,
1610 properties=dict(
1611 addresses=relationship(
1612 self.mapper_registry.map_imperatively(Address, addresses),
1613 lazy="select",
1614 )
1615 ),
1616 )
1617
1618 sess = fixture_session()
1619 u = (
1620 sess.query(User)
1621 .options(sa.orm.joinedload(User.addresses))
1622 .filter_by(id=8)
1623 ).one()
1624
1625 def go():
1626 eq_(u.id, 8)
1627 eq_(len(u.addresses), 3)
1628
1629 self.sql_count_(0, go)
1630
1631 sess.expunge_all()
1632
1633 u = sess.query(User).filter_by(id=8).one()
1634 eq_(u.id, 8)
1635 eq_(len(u.addresses), 3)
1636
1637 def test_lazy_options_with_limit(self):
1638 Address, addresses, users, User = (

Callers

nothing calls this directly

Calls 11

relationshipFunction · 0.90
fixture_sessionFunction · 0.90
eq_Function · 0.90
map_imperativelyMethod · 0.80
joinedloadMethod · 0.80
sql_count_Method · 0.80
oneMethod · 0.45
filter_byMethod · 0.45
optionsMethod · 0.45
queryMethod · 0.45
expunge_allMethod · 0.45

Tested by

no test coverage detected