diff options
Diffstat (limited to 'test/sql')
-rw-r--r-- | test/sql/test_compiler.py | 9 | ||||
-rw-r--r-- | test/sql/test_delete.py | 14 | ||||
-rw-r--r-- | test/sql/test_update.py | 11 |
3 files changed, 33 insertions, 1 deletions
diff --git a/test/sql/test_compiler.py b/test/sql/test_compiler.py index 1be76c696..917c7d89d 100644 --- a/test/sql/test_compiler.py +++ b/test/sql/test_compiler.py @@ -962,6 +962,15 @@ class SelectTest(fixtures.TestBase, AssertsCompiledSQL): ) + def test_where_empty(self): + self.assert_compile( + select([table1.c.myid]).where(and_()), + "SELECT mytable.myid FROM mytable" + ) + self.assert_compile( + select([table1.c.myid]).where(or_()), + "SELECT mytable.myid FROM mytable" + ) def test_multiple_col_binds(self): self.assert_compile( diff --git a/test/sql/test_delete.py b/test/sql/test_delete.py index b56731515..64173bb00 100644 --- a/test/sql/test_delete.py +++ b/test/sql/test_delete.py @@ -1,6 +1,6 @@ #! coding:utf-8 -from sqlalchemy import Column, Integer, String, Table, delete, select +from sqlalchemy import Column, Integer, String, Table, delete, select, and_, or_ from sqlalchemy.dialects import mysql from sqlalchemy.testing import AssertsCompiledSQL, fixtures @@ -39,6 +39,18 @@ class DeleteTest(_DeleteTestBase, fixtures.TablesTest, AssertsCompiledSQL): 'WHERE mytable.myid = :myid_1 ' 'AND mytable.name = :name_1') + def test_where_empty(self): + table1 = self.tables.mytable + + self.assert_compile( + table1.delete().where(and_()), + "DELETE FROM mytable" + ) + self.assert_compile( + table1.delete().where(or_()), + "DELETE FROM mytable" + ) + def test_prefix_with(self): table1 = self.tables.mytable diff --git a/test/sql/test_update.py b/test/sql/test_update.py index 829739bcc..a08d5f672 100644 --- a/test/sql/test_update.py +++ b/test/sql/test_update.py @@ -177,6 +177,17 @@ class UpdateTest(_UpdateFromTestBase, fixtures.TablesTest, AssertsCompiledSQL): 'mytable.myid = hoho(:hoho_1) AND ' 'mytable.name = :param_2 || mytable.name || :param_3') + def test_where_empty(self): + table1 = self.tables.mytable + self.assert_compile( + table1.update().where(and_()), + "UPDATE mytable SET myid=:myid, name=:name, description=:description" + ) + self.assert_compile( + table1.update().where(or_()), + "UPDATE mytable SET myid=:myid, name=:name, description=:description" + ) + def test_prefix_with(self): table1 = self.tables.mytable |