MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / test_having

Method test_having

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

Source from the content-addressed store, hash-verified

4328 ).one() == (79,)
4329
4330 def test_having(self):
4331 User, Address = self.classes.User, self.classes.Address
4332
4333 sess = fixture_session()
4334 assert [User(name="ed", id=8)] == sess.query(User).order_by(
4335 User.id
4336 ).group_by(User).join(User.addresses).having(
4337 func.count(Address.id) > 2
4338 ).all()
4339
4340 assert [
4341 User(name="jack", id=7),
4342 User(name="fred", id=9),
4343 ] == sess.query(User).order_by(User.id).group_by(User).join(
4344 User.addresses
4345 ).having(
4346 func.count(Address.id) < 2
4347 ).all()
4348
4349
4350class ExistsTest(QueryTest, AssertsCompiledSQL):

Callers

nothing calls this directly

Calls 9

fixture_sessionFunction · 0.90
UserClass · 0.70
allMethod · 0.45
havingMethod · 0.45
joinMethod · 0.45
group_byMethod · 0.45
order_byMethod · 0.45
queryMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected