]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Move CRUDTest, InlineDefaultTest from test_compiler
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 1 Dec 2018 19:28:57 +0000 (14:28 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 1 Dec 2018 19:28:57 +0000 (14:28 -0500)
test_compiler is mostly related to SELECT statements as well
as smaller SQL elements.  While it still has some DDL related
tests, move out all the remaining insert/update tests into
the already present test_insert.py, test_update.py

Fixes: #2630
Change-Id: I4167618543fd1235d12d1717c8c629d2374b325a

test/dialect/mssql/test_compiler.py
test/sql/test_compiler.py
test/sql/test_delete.py
test/sql/test_insert.py
test/sql/test_update.py

index 0a79b3e5980fa9ccf32a0d7267aad362eafb93af..70b9a6c9011992303f639151f223cefaf870cbb4 100644 (file)
@@ -170,6 +170,35 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
         )
         self.assert_compile(sql.delete(a1), "DELETE FROM t1 AS a1")
 
+    def test_update_from(self):
+        metadata = MetaData()
+        table1 = Table(
+            'mytable', metadata,
+            Column('myid', Integer),
+            Column('name', String(30)),
+            Column('description', String(50)))
+        table2 = Table(
+            'myothertable', metadata,
+            Column('otherid', Integer),
+            Column('othername', String(30)))
+
+        mt = table1.alias()
+
+        u = table1.update().values(name='foo')\
+                  .where(table2.c.otherid == table1.c.myid)
+
+        # testing mssql.base.MSSQLCompiler.update_from_clause
+        self.assert_compile(u,
+                            "UPDATE mytable SET name=:name "
+                            "FROM mytable, myothertable WHERE "
+                            "myothertable.otherid = mytable.myid")
+
+        self.assert_compile(u.where(table2.c.othername == mt.c.name),
+                            "UPDATE mytable SET name=:name "
+                            "FROM mytable, myothertable, mytable AS mytable_1 "
+                            "WHERE myothertable.otherid = mytable.myid "
+                            "AND myothertable.othername = mytable_1.name")
+
     def test_update_from_hint(self):
         t = table('sometable', column('somecolumn'))
         t2 = table('othertable', column('somecolumn'))
index 22b46cc46bda1abf02316a7f45aa458f5e972ac3..f543b86773dd39d56f367f0fd1347cd16b65487d 100644 (file)
@@ -3037,221 +3037,6 @@ class ExecutionOptionsTest(fixtures.TestBase):
         eq_(compiled.execution_options, {"autocommit": False})
 
 
-class CRUDTest(fixtures.TestBase, AssertsCompiledSQL):
-    __dialect__ = 'default_enhanced'
-
-    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_insert_literal_binds_sequence_notimplemented(self):
-        table = Table('x', MetaData(), Column('y', Integer, Sequence('y_seq')))
-        dialect = default.DefaultDialect()
-        dialect.supports_sequences = True
-
-        stmt = table.insert().values(myid=3, name='jack')
-
-        assert_raises(
-            NotImplementedError,
-            stmt.compile,
-            compile_kwargs=dict(literal_binds=True), dialect=dialect
-        )
-
-    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(
-            table1,
-            values={
-                table1.c.name:
-                text("(select name from mytable where id=mytable.id)")
-            }
-        )
-        self.assert_compile(
-            u,
-            "UPDATE mytable SET name=(select name from mytable "
-            "where id=mytable.id)")
-
-        mt = table1.alias()
-        u = update(table1, values={
-            table1.c.name:
-            select([mt.c.name], mt.c.myid == table1.c.myid)
-        })
-        self.assert_compile(
-            u, "UPDATE mytable SET name=(SELECT mytable_1.name FROM "
-            "mytable AS mytable_1 WHERE "
-            "mytable_1.myid = mytable.myid)")
-
-        # test against a regular constructed subquery
-        s = select([table2], table2.c.otherid == table1.c.myid)
-        u = update(table1, table1.c.name == 'jack', values={table1.c.name: s})
-        self.assert_compile(
-            u, "UPDATE mytable SET name=(SELECT myothertable.otherid, "
-            "myothertable.othername FROM myothertable WHERE "
-            "myothertable.otherid = mytable.myid) "
-            "WHERE mytable.name = :name_1")
-
-        # test a non-correlated WHERE clause
-        s = select([table2.c.othername], table2.c.otherid == 7)
-        u = update(table1, table1.c.name == s)
-        self.assert_compile(u,
-                            "UPDATE mytable SET myid=:myid, name=:name, "
-                            "description=:description WHERE mytable.name = "
-                            "(SELECT myothertable.othername FROM myothertable "
-                            "WHERE myothertable.otherid = :otherid_1)")
-
-        # test one that is actually correlated...
-        s = select([table2.c.othername], table2.c.otherid == table1.c.myid)
-        u = table1.update(table1.c.name == s)
-        self.assert_compile(u,
-                            "UPDATE mytable SET myid=:myid, name=:name, "
-                            "description=:description WHERE mytable.name = "
-                            "(SELECT myothertable.othername FROM myothertable "
-                            "WHERE myothertable.otherid = mytable.myid)")
-
-        # test correlated FROM implicit in WHERE and SET clauses
-        u = table1.update().values(name=table2.c.othername)\
-                  .where(table2.c.otherid == table1.c.myid)
-        self.assert_compile(
-            u, "UPDATE mytable SET name=myothertable.othername "
-            "FROM myothertable WHERE myothertable.otherid = mytable.myid")
-        u = table1.update().values(name='foo')\
-                  .where(table2.c.otherid == table1.c.myid)
-        self.assert_compile(
-            u, "UPDATE mytable SET name=:name "
-            "FROM myothertable WHERE myothertable.otherid = mytable.myid")
-
-        self.assert_compile(u,
-                            "UPDATE mytable SET name=:name "
-                            "FROM mytable, myothertable WHERE "
-                            "myothertable.otherid = mytable.myid",
-                            dialect=mssql.dialect())
-
-        self.assert_compile(u.where(table2.c.othername == mt.c.name),
-                            "UPDATE mytable SET name=:name "
-                            "FROM mytable, myothertable, mytable AS mytable_1 "
-                            "WHERE myothertable.otherid = mytable.myid "
-                            "AND myothertable.othername = mytable_1.name",
-                            dialect=mssql.dialect())
-
-    def test_binds_that_match_columns(self):
-        """test bind params named after column names
-        replace the normal SET/VALUES generation."""
-
-        t = table('foo', column('x'), column('y'))
-
-        u = t.update().where(t.c.x == bindparam('x'))
-
-        assert_raises(exc.CompileError, u.compile)
-
-        self.assert_compile(u, "UPDATE foo SET  WHERE foo.x = :x", params={})
-
-        assert_raises(exc.CompileError, u.values(x=7).compile)
-
-        self.assert_compile(u.values(y=7),
-                            "UPDATE foo SET y=:y WHERE foo.x = :x")
-
-        assert_raises(exc.CompileError,
-                      u.values(x=7).compile, column_keys=['x', 'y'])
-        assert_raises(exc.CompileError, u.compile, column_keys=['x', 'y'])
-
-        self.assert_compile(
-            u.values(
-                x=3 +
-                bindparam('x')),
-            "UPDATE foo SET x=(:param_1 + :x) WHERE foo.x = :x")
-
-        self.assert_compile(
-            u.values(
-                x=3 +
-                bindparam('x')),
-            "UPDATE foo SET x=(:param_1 + :x) WHERE foo.x = :x",
-            params={
-                'x': 1})
-
-        self.assert_compile(
-            u.values(
-                x=3 +
-                bindparam('x')),
-            "UPDATE foo SET x=(:param_1 + :x), y=:y WHERE foo.x = :x",
-            params={
-                'x': 1,
-                'y': 2})
-
-        i = t.insert().values(x=3 + bindparam('x'))
-        self.assert_compile(i,
-                            "INSERT INTO foo (x) VALUES ((:param_1 + :x))")
-        self.assert_compile(
-            i,
-            "INSERT INTO foo (x, y) VALUES ((:param_1 + :x), :y)",
-            params={
-                'x': 1,
-                'y': 2})
-
-        i = t.insert().values(x=bindparam('y'))
-        self.assert_compile(i, "INSERT INTO foo (x) VALUES (:y)")
-
-        i = t.insert().values(x=bindparam('y'), y=5)
-        assert_raises(exc.CompileError, i.compile)
-
-        i = t.insert().values(x=3 + bindparam('y'), y=5)
-        assert_raises(exc.CompileError, i.compile)
-
-        i = t.insert().values(x=3 + bindparam('x2'))
-        self.assert_compile(i,
-                            "INSERT INTO foo (x) VALUES ((:param_1 + :x2))")
-        self.assert_compile(
-            i,
-            "INSERT INTO foo (x) VALUES ((:param_1 + :x2))",
-            params={})
-        self.assert_compile(
-            i,
-            "INSERT INTO foo (x, y) VALUES ((:param_1 + :x2), :y)",
-            params={
-                'x': 1,
-                'y': 2})
-        self.assert_compile(
-            i,
-            "INSERT INTO foo (x, y) VALUES ((:param_1 + :x2), :y)",
-            params={
-                'x2': 1,
-                'y': 2})
-
-    def test_labels_no_collision(self):
-
-        t = table('foo', column('id'), column('foo_id'))
-
-        self.assert_compile(
-            t.update().where(t.c.id == 5),
-            "UPDATE foo SET id=:id, foo_id=:foo_id WHERE foo.id = :id_1"
-        )
-
-        self.assert_compile(
-            t.update().where(t.c.id == bindparam(key=t.c.id._label)),
-            "UPDATE foo SET id=:id, foo_id=:foo_id WHERE foo.id = :foo_id_1"
-        )
-
-
 class DDLTest(fixtures.TestBase, AssertsCompiledSQL):
     __dialect__ = 'default'
 
@@ -3425,45 +3210,6 @@ class DDLTest(fixtures.TestBase, AssertsCompiledSQL):
         )
 
 
-class InlineDefaultTest(fixtures.TestBase, AssertsCompiledSQL):
-    __dialect__ = 'default'
-
-    def test_insert(self):
-        m = MetaData()
-        foo = Table('foo', m,
-                    Column('id', Integer))
-
-        t = Table('test', m,
-                  Column('col1', Integer, default=func.foo(1)),
-                  Column('col2', Integer, default=select(
-                      [func.coalesce(func.max(foo.c.id))])),
-                  )
-
-        self.assert_compile(
-            t.insert(
-                inline=True, values={}),
-            "INSERT INTO test (col1, col2) VALUES (foo(:foo_1), "
-            "(SELECT coalesce(max(foo.id)) AS coalesce_1 FROM "
-            "foo))")
-
-    def test_update(self):
-        m = MetaData()
-        foo = Table('foo', m,
-                    Column('id', Integer))
-
-        t = Table('test', m,
-                  Column('col1', Integer, onupdate=func.foo(1)),
-                  Column('col2', Integer, onupdate=select(
-                      [func.coalesce(func.max(foo.c.id))])),
-                  Column('col3', String(30))
-                  )
-
-        self.assert_compile(t.update(inline=True, values={'col3': 'foo'}),
-                            "UPDATE test SET col1=foo(:foo_1), col2=(SELECT "
-                            "coalesce(max(foo.id)) AS coalesce_1 FROM foo), "
-                            "col3=:col3")
-
-
 class SchemaTest(fixtures.TestBase, AssertsCompiledSQL):
     __dialect__ = 'default'
 
@@ -3981,7 +3727,6 @@ class CorrelateTest(fixtures.TestBase, AssertsCompiledSQL):
         # multilevel FROM clauses behaves like 0.8.1 (i.e. doesn't happen)
         t1 = table('t1', column('x'))
         t2 = table('t2', column('y'))
-        t3 = table('t3', column('z'))
 
         s = select([t1.c.x]).where(t1.c.x == t2.c.y)
         s2 = select([t2, s])
index 91f2c2cdc2b284d2fb529068fefacefc0128964d..331a536018244f74a1f9e601df84ccf87b41d40b 100644 (file)
@@ -27,6 +27,16 @@ class _DeleteTestBase(object):
 class DeleteTest(_DeleteTestBase, fixtures.TablesTest, AssertsCompiledSQL):
     __dialect__ = 'default'
 
+    def test_delete_literal_binds(self):
+        table1 = self.tables.mytable
+
+        stmt = table1.delete().where(table1.c.name == 'jill')
+
+        self.assert_compile(
+            stmt,
+            "DELETE FROM mytable WHERE mytable.name = 'jill'",
+            literal_binds=True)
+
     def test_delete(self):
         table1 = self.tables.mytable
 
index 6ea5b4f37c90213f15fc2ef0413aae632a139498..729c420c0000069a22656624f7d951c71bcbf6f5 100644 (file)
@@ -6,7 +6,7 @@ from sqlalchemy import Column, Integer, MetaData, String, Table,\
 from sqlalchemy.dialects import mysql, postgresql
 from sqlalchemy.engine import default
 from sqlalchemy.testing import AssertsCompiledSQL,\
-    assert_raises_message, fixtures, eq_, expect_warnings
+    assert_raises_message, fixtures, eq_, expect_warnings, assert_raises
 from sqlalchemy.sql import crud
 
 
@@ -31,6 +31,91 @@ class _InsertTestBase(object):
 class InsertTest(_InsertTestBase, fixtures.TablesTest, AssertsCompiledSQL):
     __dialect__ = 'default'
 
+    def test_binds_that_match_columns(self):
+        """test bind params named after column names
+        replace the normal SET/VALUES generation."""
+
+        t = table('foo', column('x'), column('y'))
+
+        i = t.insert().values(x=3 + bindparam('x'))
+        self.assert_compile(i,
+                            "INSERT INTO foo (x) VALUES ((:param_1 + :x))")
+        self.assert_compile(
+            i,
+            "INSERT INTO foo (x, y) VALUES ((:param_1 + :x), :y)",
+            params={
+                'x': 1,
+                'y': 2})
+
+        i = t.insert().values(x=bindparam('y'))
+        self.assert_compile(i, "INSERT INTO foo (x) VALUES (:y)")
+
+        i = t.insert().values(x=bindparam('y'), y=5)
+        assert_raises(exc.CompileError, i.compile)
+
+        i = t.insert().values(x=3 + bindparam('y'), y=5)
+        assert_raises(exc.CompileError, i.compile)
+
+        i = t.insert().values(x=3 + bindparam('x2'))
+        self.assert_compile(i,
+                            "INSERT INTO foo (x) VALUES ((:param_1 + :x2))")
+        self.assert_compile(
+            i,
+            "INSERT INTO foo (x) VALUES ((:param_1 + :x2))",
+            params={})
+        self.assert_compile(
+            i,
+            "INSERT INTO foo (x, y) VALUES ((:param_1 + :x2), :y)",
+            params={
+                'x': 1,
+                'y': 2})
+        self.assert_compile(
+            i,
+            "INSERT INTO foo (x, y) VALUES ((:param_1 + :x2), :y)",
+            params={
+                'x2': 1,
+                'y': 2})
+
+    def test_insert_literal_binds(self):
+        table1 = self.tables.mytable
+        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_insert_literal_binds_sequence_notimplemented(self):
+        table = Table('x', MetaData(), Column('y', Integer, Sequence('y_seq')))
+        dialect = default.DefaultDialect()
+        dialect.supports_sequences = True
+
+        stmt = table.insert().values(myid=3, name='jack')
+
+        assert_raises(
+            NotImplementedError,
+            stmt.compile,
+            compile_kwargs=dict(literal_binds=True), dialect=dialect
+        )
+
+    def test_inline_defaults(self):
+        m = MetaData()
+        foo = Table('foo', m,
+                    Column('id', Integer))
+
+        t = Table('test', m,
+                  Column('col1', Integer, default=func.foo(1)),
+                  Column('col2', Integer, default=select(
+                      [func.coalesce(func.max(foo.c.id))])),
+                  )
+
+        self.assert_compile(
+            t.insert(
+                inline=True, values={}),
+            "INSERT INTO test (col1, col2) VALUES (foo(:foo_1), "
+            "(SELECT coalesce(max(foo.id)) AS coalesce_1 FROM "
+            "foo))")
+
     def test_generic_insert_bind_params_all_columns(self):
         table1 = self.tables.mytable
 
index 138581061b3efda60b8f31179d4b9056043f30b5..56d12d92728d7e0bf38e0690a6eb7f3a5ee8f2ce 100644 (file)
@@ -1,10 +1,11 @@
 from sqlalchemy import Integer, String, ForeignKey, and_, or_, func, \
-    literal, update, table, bindparam, column, select, exc, exists
+    literal, update, table, bindparam, column, select, exc, exists, text, \
+    MetaData
 from sqlalchemy import testing
 from sqlalchemy.dialects import mysql
 from sqlalchemy.engine import default
 from sqlalchemy.testing import AssertsCompiledSQL, eq_, fixtures, \
-    assert_raises_message
+    assert_raises_message, assert_raises
 from sqlalchemy.testing.schema import Table, Column
 from sqlalchemy import util
 
@@ -68,7 +69,188 @@ class _UpdateFromTestBase(object):
 
 
 class UpdateTest(_UpdateFromTestBase, fixtures.TablesTest, AssertsCompiledSQL):
-    __dialect__ = 'default'
+    __dialect__ = 'default_enhanced'
+
+    def test_update_literal_binds(self):
+        table1 = self.tables.mytable
+
+        table1 = self.tables.mytable
+
+        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_correlated_update_one(self):
+        table1 = self.tables.mytable
+
+        # test against a straight text subquery
+        u = update(
+            table1,
+            values={
+                table1.c.name:
+                text("(select name from mytable where id=mytable.id)")
+            }
+        )
+        self.assert_compile(
+            u,
+            "UPDATE mytable SET name=(select name from mytable "
+            "where id=mytable.id)")
+
+    def test_correlated_update_two(self):
+        table1 = self.tables.mytable
+
+        mt = table1.alias()
+        u = update(table1, values={
+            table1.c.name:
+            select([mt.c.name], mt.c.myid == table1.c.myid)
+        })
+        self.assert_compile(
+            u, "UPDATE mytable SET name=(SELECT mytable_1.name FROM "
+            "mytable AS mytable_1 WHERE "
+            "mytable_1.myid = mytable.myid)")
+
+    def test_correlated_update_three(self):
+        table1 = self.tables.mytable
+        table2 = self.tables.myothertable
+
+        # test against a regular constructed subquery
+        s = select([table2], table2.c.otherid == table1.c.myid)
+        u = update(table1, table1.c.name == 'jack', values={table1.c.name: s})
+        self.assert_compile(
+            u, "UPDATE mytable SET name=(SELECT myothertable.otherid, "
+            "myothertable.othername FROM myothertable WHERE "
+            "myothertable.otherid = mytable.myid) "
+            "WHERE mytable.name = :name_1")
+
+    def test_correlated_update_four(self):
+        table1 = self.tables.mytable
+        table2 = self.tables.myothertable
+
+        # test a non-correlated WHERE clause
+        s = select([table2.c.othername], table2.c.otherid == 7)
+        u = update(table1, table1.c.name == s)
+        self.assert_compile(u,
+                            "UPDATE mytable SET myid=:myid, name=:name, "
+                            "description=:description WHERE mytable.name = "
+                            "(SELECT myothertable.othername FROM myothertable "
+                            "WHERE myothertable.otherid = :otherid_1)")
+
+    def test_correlated_update_five(self):
+        table1 = self.tables.mytable
+        table2 = self.tables.myothertable
+
+        # test one that is actually correlated...
+        s = select([table2.c.othername], table2.c.otherid == table1.c.myid)
+        u = table1.update(table1.c.name == s)
+        self.assert_compile(u,
+                            "UPDATE mytable SET myid=:myid, name=:name, "
+                            "description=:description WHERE mytable.name = "
+                            "(SELECT myothertable.othername FROM myothertable "
+                            "WHERE myothertable.otherid = mytable.myid)")
+
+    def test_correlated_update_six(self):
+        table1 = self.tables.mytable
+        table2 = self.tables.myothertable
+
+        # test correlated FROM implicit in WHERE and SET clauses
+        u = table1.update().values(name=table2.c.othername)\
+                  .where(table2.c.otherid == table1.c.myid)
+        self.assert_compile(
+            u, "UPDATE mytable SET name=myothertable.othername "
+            "FROM myothertable WHERE myothertable.otherid = mytable.myid")
+
+    def test_correlated_update_seven(self):
+        table1 = self.tables.mytable
+        table2 = self.tables.myothertable
+
+        u = table1.update().values(name='foo')\
+                  .where(table2.c.otherid == table1.c.myid)
+
+        # this is the "default_enhanced" compiler.  there's no UPDATE FROM
+        # in the base compiler.
+        # See also test/dialect/mssql/test_compiler->test_update_from().
+        self.assert_compile(
+            u, "UPDATE mytable SET name=:name "
+            "FROM myothertable WHERE myothertable.otherid = mytable.myid")
+
+    def test_binds_that_match_columns(self):
+        """test bind params named after column names
+        replace the normal SET/VALUES generation."""
+
+        t = table('foo', column('x'), column('y'))
+
+        u = t.update().where(t.c.x == bindparam('x'))
+
+        assert_raises(exc.CompileError, u.compile)
+
+        self.assert_compile(u, "UPDATE foo SET  WHERE foo.x = :x", params={})
+
+        assert_raises(exc.CompileError, u.values(x=7).compile)
+
+        self.assert_compile(u.values(y=7),
+                            "UPDATE foo SET y=:y WHERE foo.x = :x")
+
+        assert_raises(exc.CompileError,
+                      u.values(x=7).compile, column_keys=['x', 'y'])
+        assert_raises(exc.CompileError, u.compile, column_keys=['x', 'y'])
+
+        self.assert_compile(
+            u.values(
+                x=3 +
+                bindparam('x')),
+            "UPDATE foo SET x=(:param_1 + :x) WHERE foo.x = :x")
+
+        self.assert_compile(
+            u.values(
+                x=3 +
+                bindparam('x')),
+            "UPDATE foo SET x=(:param_1 + :x) WHERE foo.x = :x",
+            params={
+                'x': 1})
+
+        self.assert_compile(
+            u.values(
+                x=3 +
+                bindparam('x')),
+            "UPDATE foo SET x=(:param_1 + :x), y=:y WHERE foo.x = :x",
+            params={
+                'x': 1,
+                'y': 2})
+
+    def test_labels_no_collision(self):
+
+        t = table('foo', column('id'), column('foo_id'))
+
+        self.assert_compile(
+            t.update().where(t.c.id == 5),
+            "UPDATE foo SET id=:id, foo_id=:foo_id WHERE foo.id = :id_1"
+        )
+
+        self.assert_compile(
+            t.update().where(t.c.id == bindparam(key=t.c.id._label)),
+            "UPDATE foo SET id=:id, foo_id=:foo_id WHERE foo.id = :foo_id_1"
+        )
+
+    def test_inline_defaults(self):
+        m = MetaData()
+        foo = Table('foo', m,
+                    Column('id', Integer))
+
+        t = Table('test', m,
+                  Column('col1', Integer, onupdate=func.foo(1)),
+                  Column('col2', Integer, onupdate=select(
+                      [func.coalesce(func.max(foo.c.id))])),
+                  Column('col3', String(30))
+                  )
+
+        self.assert_compile(t.update(inline=True, values={'col3': 'foo'}),
+                            "UPDATE test SET col1=foo(:foo_1), col2=(SELECT "
+                            "coalesce(max(foo.id)) AS coalesce_1 FROM foo), "
+                            "col3=:col3")
 
     def test_update_1(self):
         table1 = self.tables.mytable