MCPcopy Create free account
hub / github.com/tortoise/tortoise-orm / test_aggregate_max

Function test_aggregate_max

tests/fields/test_decimal.py:261–270  ·  view source on GitHub ↗
(db)

Source from the content-addressed store, hash-verified

259
260@pytest.mark.asyncio
261async def test_aggregate_max(db):
262 await testmodels.DecimalFields.create(decimal=Decimal("0"), decimal_nodec=1)
263 await testmodels.DecimalFields.create(decimal=Decimal("9.99"), decimal_nodec=1)
264 await testmodels.DecimalFields.create(decimal=Decimal("27.27"), decimal_nodec=1)
265 values = (
266 await testmodels.DecimalFields.all()
267 .annotate(max_decimal=Max("decimal"))
268 .values("max_decimal")
269 )
270 assert values[0] == {"max_decimal": Decimal("27.27")}
271
272
273@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 5

MaxClass · 0.90
createMethod · 0.45
valuesMethod · 0.45
annotateMethod · 0.45
allMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…