summaryrefslogtreecommitdiff
path: root/test/sql
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2016-02-03 11:07:44 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2016-02-03 11:07:44 -0500
commit150591f9e0a94902cb2a76b68ac7c9d8a1a3ec83 (patch)
tree88e0853370bc6d306f54047b5c85cf9bb4155e24 /test/sql
parentc9b03fa8afd52646aba8c59fc038330eeee6db60 (diff)
downloadsqlalchemy-150591f9e0a94902cb2a76b68ac7c9d8a1a3ec83.tar.gz
- add literal_binds for delete() statements in addition to insert()/update()
- move tests to CRUDTest - changelog, fixes #3643
Diffstat (limited to 'test/sql')
-rw-r--r--test/sql/test_compiler.py41
1 files changed, 25 insertions, 16 deletions
diff --git a/test/sql/test_compiler.py b/test/sql/test_compiler.py
index 00195c6bf..f11a4e61a 100644
--- a/test/sql/test_compiler.py
+++ b/test/sql/test_compiler.py
@@ -255,22 +255,6 @@ class SelectTest(fixtures.TestBase, AssertsCompiledSQL):
literal_binds=True
)
- def test_insert_literal_binds(self):
- stmt = table1.insert().values(myid=3, name='jack')
-
- self.assert_compile(
- stmt,
- "INSERT INTO mytable (myid, name) VALUES (3, 'jack')",
- literal_binds=True)
-
- def test_update_literal_binds(self):
- stmt = table1.update().values(name='jack').where(table1.c.name == 'jill')
-
- self.assert_compile(
- stmt,
- "UPDATE mytable SET name='jack' WHERE mytable.name = 'jill'",
- literal_binds=True)
-
def test_select_precol_compile_ordering(self):
s1 = select([column('x')]).select_from(text('a')).limit(5).as_scalar()
s2 = select([s1]).limit(10)
@@ -2730,6 +2714,31 @@ class KwargPropagationTest(fixtures.TestBase):
class CRUDTest(fixtures.TestBase, AssertsCompiledSQL):
__dialect__ = 'default'
+ def test_insert_literal_binds(self):
+ stmt = table1.insert().values(myid=3, name='jack')
+
+ self.assert_compile(
+ stmt,
+ "INSERT INTO mytable (myid, name) VALUES (3, 'jack')",
+ literal_binds=True)
+
+ def test_update_literal_binds(self):
+ stmt = table1.update().values(name='jack').\
+ where(table1.c.name == 'jill')
+
+ self.assert_compile(
+ stmt,
+ "UPDATE mytable SET name='jack' WHERE mytable.name = 'jill'",
+ literal_binds=True)
+
+ def test_delete_literal_binds(self):
+ stmt = table1.delete().where(table1.c.name == 'jill')
+
+ self.assert_compile(
+ stmt,
+ "DELETE FROM mytable WHERE mytable.name = 'jill'",
+ literal_binds=True)
+
def test_correlated_update(self):
# test against a straight text subquery
u = update(