diff options
Diffstat (limited to 'test/sql/select.py')
| -rw-r--r-- | test/sql/select.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/test/sql/select.py b/test/sql/select.py index facfb5287..3b6964e7d 100644 --- a/test/sql/select.py +++ b/test/sql/select.py @@ -1166,13 +1166,13 @@ UNION SELECT mytable.myid FROM mytable" self.assert_compile(select([table1], table1.c.myid.in_( union( - select([table1], table1.c.myid == 5), - select([table1], table1.c.myid == 12), + select([table1.c.myid], table1.c.myid == 5), + select([table1.c.myid], table1.c.myid == 12), ) )), "SELECT mytable.myid, mytable.name, mytable.description FROM mytable \ WHERE mytable.myid IN (\ -SELECT mytable.myid, mytable.name, mytable.description FROM mytable WHERE mytable.myid = :myid_1 \ -UNION SELECT mytable.myid, mytable.name, mytable.description FROM mytable WHERE mytable.myid = :myid_2)") +SELECT mytable.myid FROM mytable WHERE mytable.myid = :myid_1 \ +UNION SELECT mytable.myid FROM mytable WHERE mytable.myid = :myid_2)") # test that putting a select in an IN clause does not blow away its ORDER BY clause self.assert_compile( @@ -1191,6 +1191,15 @@ UNION SELECT mytable.myid, mytable.name, mytable.description FROM mytable WHERE self.assert_compile(select([table1], table1.c.myid.in_([])), "SELECT mytable.myid, mytable.name, mytable.description FROM mytable WHERE (CASE WHEN (mytable.myid IS NULL) THEN NULL ELSE 0 END = 1)") + self.assert_compile( + select([table1.c.myid.in_(select([table2.c.otherid]))]), + "SELECT mytable.myid IN (SELECT myothertable.otherid FROM myothertable) AS anon_1 FROM mytable" + ) + self.assert_compile( + select([table1.c.myid.in_(select([table2.c.otherid]).as_scalar())]), + "SELECT mytable.myid IN (SELECT myothertable.otherid FROM myothertable) AS anon_1 FROM mytable" + ) + def test_cast(self): tbl = table('casttest', column('id', Integer), |
