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

Function test_update

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

Source from the content-addressed store, hash-verified

182
183
184def test_update(sql_context):
185 db, dialect, is_psycopg = sql_context
186 sql = IntFields.filter(intnum=2).update(intnum=1).sql()
187 if dialect == "mysql":
188 expected = "UPDATE `intfields` SET `intnum`=%s WHERE `intnum`=%s"
189 elif dialect == "postgres":
190 if is_psycopg:
191 expected = 'UPDATE "intfields" SET "intnum"=%s WHERE "intnum"=%s'
192 else:
193 expected = 'UPDATE "intfields" SET "intnum"=$1 WHERE "intnum"=$2'
194 else:
195 expected = 'UPDATE "intfields" SET "intnum"=? WHERE "intnum"=?'
196 assert sql == expected
197
198
199def test_delete(sql_context):

Callers

nothing calls this directly

Calls 3

updateMethod · 0.80
sqlMethod · 0.45
filterMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…