MCPcopy
hub / github.com/tortoise/tortoise-orm / test_group_by

Function test_group_by

tests/test_sql.py:55–62  ·  view source on GitHub ↗
(sql_context)

Source from the content-addressed store, hash-verified

53
54
55def test_group_by(sql_context):
56 db, dialect, is_psycopg = sql_context
57 sql = IntFields.all().group_by("intnum").values("intnum").sql()
58 if dialect == "mysql":
59 expected = "SELECT `intnum` `intnum` FROM `intfields` GROUP BY `intnum`"
60 else:
61 expected = 'SELECT "intnum" "intnum" FROM "intfields" GROUP BY "intnum"'
62 assert sql == expected
63
64
65def test_annotate(sql_context):

Callers

nothing calls this directly

Calls 4

group_byMethod · 0.80
sqlMethod · 0.45
valuesMethod · 0.45
allMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…