MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_aggregate_order_by_adapt

Method test_aggregate_order_by_adapt

test/sql/test_functions.py:1247–1260  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1245 )
1246
1247 def test_aggregate_order_by_adapt(self):
1248 table = Table(
1249 "table1", MetaData(), Column("a", Integer), Column("b", Integer)
1250 )
1251 expr = aggregate_order_by(func.array_agg(table.c.a), table.c.b.desc())
1252 stmt = select(expr)
1253
1254 a1 = table.alias("foo")
1255 stmt2 = util.ClauseAdapter(a1).traverse(stmt)
1256 self.assert_compile(
1257 stmt2,
1258 "SELECT array_agg(foo.a ORDER BY foo.b DESC) AS array_agg_1 "
1259 "FROM table1 AS foo",
1260 )
1261
1262
1263class CollectionAggregateFunctionTest(fixtures.TestBase, AssertsCompiledSQL):

Callers

nothing calls this directly

Calls 10

TableClass · 0.90
MetaDataClass · 0.90
ColumnClass · 0.90
aggregate_order_byClass · 0.90
selectFunction · 0.90
array_aggMethod · 0.80
assert_compileMethod · 0.80
descMethod · 0.45
aliasMethod · 0.45
traverseMethod · 0.45

Tested by

no test coverage detected