MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_legacy_delete_limit

Method test_legacy_delete_limit

test/dialect/mysql/test_compiler.py:1077–1099  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1075 )
1076
1077 def test_legacy_delete_limit(self):
1078 t = sql.table("t", sql.column("col1"), sql.column("col2"))
1079
1080 self.assert_compile(t.delete(), "DELETE FROM t")
1081 self.assert_compile(
1082 t.delete().with_dialect_options(mysql_limit=5),
1083 "DELETE FROM t LIMIT 5",
1084 )
1085 # does not make sense but we want this to compile
1086 self.assert_compile(
1087 t.delete().with_dialect_options(mysql_limit=0),
1088 "DELETE FROM t LIMIT 0",
1089 )
1090 self.assert_compile(
1091 t.delete().with_dialect_options(mysql_limit=None),
1092 "DELETE FROM t",
1093 )
1094 self.assert_compile(
1095 t.delete()
1096 .where(t.c.col2 == 456)
1097 .with_dialect_options(mysql_limit=1),
1098 "DELETE FROM t WHERE t.col2 = %s LIMIT 1",
1099 )
1100
1101 @testing.combinations((update,), (delete,))
1102 def test_legacy_update_delete_limit_int_only(self, crud_fn):

Callers

nothing calls this directly

Calls 6

assert_compileMethod · 0.80
with_dialect_optionsMethod · 0.80
tableMethod · 0.45
columnMethod · 0.45
deleteMethod · 0.45
whereMethod · 0.45

Tested by

no test coverage detected