diff options
Diffstat (limited to 'test/sql/test_select.py')
| -rw-r--r-- | test/sql/test_select.py | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/test/sql/test_select.py b/test/sql/test_select.py index 17b47d96d..c9abb7fb8 100644 --- a/test/sql/test_select.py +++ b/test/sql/test_select.py @@ -8,15 +8,16 @@ from sqlalchemy import MetaData from sqlalchemy import select from sqlalchemy import String from sqlalchemy import Table +from sqlalchemy import testing from sqlalchemy import tuple_ from sqlalchemy import union from sqlalchemy.sql import column +from sqlalchemy.sql import literal from sqlalchemy.sql import table from sqlalchemy.testing import assert_raises_message from sqlalchemy.testing import AssertsCompiledSQL from sqlalchemy.testing import fixtures - table1 = table( "mytable", column("myid", Integer), @@ -412,3 +413,23 @@ class FutureSelectTest(fixtures.TestBase, AssertsCompiledSQL): "SELECT anon_1.name FROM (SELECT mytable.name AS name, " "(mytable.myid, mytable.name) AS anon_2 FROM mytable) AS anon_1", ) + + @testing.combinations( + ("union_all", "UNION ALL"), + ("union", "UNION"), + ("intersect_all", "INTERSECT ALL"), + ("intersect", "INTERSECT"), + ("except_all", "EXCEPT ALL"), + ("except_", "EXCEPT"), + ) + def test_select_multiple_compound_elements(self, methname, joiner): + stmt = select(literal(1)) + meth = getattr(stmt, methname) + stmt = meth(select(literal(2)), select(literal(3))) + + self.assert_compile( + stmt, + "SELECT :param_1 AS anon_1" + " %(joiner)s SELECT :param_2 AS anon_2" + " %(joiner)s SELECT :param_3 AS anon_3" % {"joiner": joiner}, + ) |
