diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-05-28 13:28:38 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-05-28 13:28:38 -0400 |
| commit | 736481e58f62841f3be9cb34f58f426fc52594b1 (patch) | |
| tree | 8f850e4f9ef7a5cfff022238307e55e6cedcfe69 /test/sql/test_selectable.py | |
| parent | 7e7372fc8597eea4e4bf04fa5e013ac01a2c0b84 (diff) | |
| download | sqlalchemy-736481e58f62841f3be9cb34f58f426fc52594b1.tar.gz | |
- Streamlined the process by which a Select
determines what's in it's '.c' collection.
Behaves identically, except that a
raw ClauseList() passed to select([])
(which is not a documented case anyway) will
now be expanded into its individual column
elements instead of being ignored.
Diffstat (limited to 'test/sql/test_selectable.py')
| -rw-r--r-- | test/sql/test_selectable.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/sql/test_selectable.py b/test/sql/test_selectable.py index 47d81b879..af11694dc 100644 --- a/test/sql/test_selectable.py +++ b/test/sql/test_selectable.py @@ -319,6 +319,34 @@ class SelectableTest(fixtures.TestBase, AssertsExecutionResults, AssertsCompiled "SELECT c FROM (SELECT (SELECT (SELECT table1.col1 AS a FROM table1) AS b) AS c)" ) + def test_unusual_column_elements_text(self): + """test that .c excludes text().""" + + s = select([table1.c.col1, text("foo")]) + eq_( + list(s.c), + [s.c.col1] + ) + + def test_unusual_column_elements_clauselist(self): + """Test that raw ClauseList is expanded into .c.""" + + from sqlalchemy.sql.expression import ClauseList + s = select([table1.c.col1, ClauseList(table1.c.col2, table1.c.col3)]) + eq_( + list(s.c), + [s.c.col1, s.c.col2, s.c.col3] + ) + + def test_unusual_column_elements_boolean_clauselist(self): + """test that BooleanClauseList is placed as single element in .c.""" + + c2 = and_(table1.c.col2==5, table1.c.col3==4) + s = select([table1.c.col1, c2]) + eq_( + list(s.c), + [s.c.col1, s.corresponding_column(c2)] + ) class AnonLabelTest(fixtures.TestBase): """Test behaviors that we hope to change with [ticket:2168].""" |
