MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_aggregate

Method test_aggregate

test/orm/test_generative.py:79–98  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

77 assert query[10:20][5] == orig[10:20][5]
78
79 def test_aggregate(self):
80 foo, Foo = self.tables.foo, self.classes.Foo
81
82 sess = fixture_session()
83 query = sess.query(Foo)
84 assert query.count() == 100
85 assert sess.query(func.min(foo.c.bar)).filter(
86 foo.c.bar < 30
87 ).one() == (0,)
88
89 assert sess.query(func.max(foo.c.bar)).filter(
90 foo.c.bar < 30
91 ).one() == (29,)
92
93 eq_(
94 query.filter(foo.c.bar < 30)
95 .with_entities(sa.func.max(foo.c.bar))
96 .scalar(),
97 29,
98 )
99
100 @testing.fails_if(
101 lambda: testing.against("mysql+mysqldb")

Callers

nothing calls this directly

Calls 10

fixture_sessionFunction · 0.90
eq_Function · 0.90
minMethod · 0.80
maxMethod · 0.80
with_entitiesMethod · 0.80
queryMethod · 0.45
countMethod · 0.45
oneMethod · 0.45
filterMethod · 0.45
scalarMethod · 0.45

Tested by

no test coverage detected