MCPcopy Index your code
hub / github.com/tortoise/tortoise-orm / test_count

Function test_count

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

Source from the content-addressed store, hash-verified

167
168
169def test_count(sql_context):
170 db, dialect, is_psycopg = sql_context
171 sql = IntFields.all().filter(intnum=1).count().sql()
172 if dialect == "mysql":
173 expected = "SELECT COUNT(*) FROM `intfields` WHERE `intnum`=%s"
174 elif dialect == "postgres":
175 if is_psycopg:
176 expected = 'SELECT COUNT(*) FROM "intfields" WHERE "intnum"=%s'
177 else:
178 expected = 'SELECT COUNT(*) FROM "intfields" WHERE "intnum"=$1'
179 else:
180 expected = 'SELECT COUNT(*) FROM "intfields" WHERE "intnum"=?'
181 assert sql == expected
182
183
184def test_update(sql_context):

Callers

nothing calls this directly

Calls 4

countMethod · 0.80
sqlMethod · 0.45
filterMethod · 0.45
allMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…