MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / test_delete_limit

Method test_delete_limit

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

Source from the content-addressed store, hash-verified

915 )
916
917 def test_delete_limit(self):
918 t = sql.table("t", sql.column("col1"), sql.column("col2"))
919
920 self.assert_compile(t.delete(), "DELETE FROM t")
921 self.assert_compile(
922 t.delete().with_dialect_options(mysql_limit=5),
923 "DELETE FROM t LIMIT 5",
924 )
925 # does not make sense but we want this to compile
926 self.assert_compile(
927 t.delete().with_dialect_options(mysql_limit=0),
928 "DELETE FROM t LIMIT 0",
929 )
930 self.assert_compile(
931 t.delete().with_dialect_options(mysql_limit=None),
932 "DELETE FROM t",
933 )
934 self.assert_compile(
935 t.delete()
936 .where(t.c.col2 == 456)
937 .with_dialect_options(mysql_limit=1),
938 "DELETE FROM t WHERE t.col2 = %s LIMIT 1",
939 )
940
941 @testing.combinations((update,), (delete,))
942 def test_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