diff options
| author | Jason Kirtland <jek@discorporate.us> | 2008-05-09 20:26:09 +0000 |
|---|---|---|
| committer | Jason Kirtland <jek@discorporate.us> | 2008-05-09 20:26:09 +0000 |
| commit | e41c0f4107a132b2feac83ba07a25a336e7eae0b (patch) | |
| tree | 09c785fd5ef9557c3fc926afd7e0a78702dd8023 /test/sql/labels.py | |
| parent | a2122a89f6d4f2d3ccc4ba7665cd588c2b0b93b0 (diff) | |
| download | sqlalchemy-e41c0f4107a132b2feac83ba07a25a336e7eae0b.tar.gz | |
Test suite modernization in progress. Big changes:
- @unsupported now only accepts a single target and demands a reason
for not running the test.
- @exclude also demands an exclusion reason
- Greatly expanded @testing.requires.<feature>, eliminating many
decorators in the suite and signficantly easing integration of
multi-driver support.
- New ORM test base class, and a featureful base for mapped tests
- Usage of 'global' for shared setup going away, * imports as well
Diffstat (limited to 'test/sql/labels.py')
| -rw-r--r-- | test/sql/labels.py | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/test/sql/labels.py b/test/sql/labels.py index cbcd4636e..78b31adc4 100644 --- a/test/sql/labels.py +++ b/test/sql/labels.py @@ -99,30 +99,34 @@ class LongLabelsTest(TestBase, AssertsCompiledSQL): table1.insert().execute(**{"this_is_the_data_column":"data3"}) table1.insert().execute(**{"this_is_the_data_column":"data4"}) + @testing.requires.subqueries def test_subquery(self): - # this is the test that fails if the "max identifier length" is shorter than the - # length of the actual columns created, because the column names get truncated. - # if you try to separate "physical columns" from "labels", and only truncate the labels, - # the compiler.DefaultCompiler.visit_select() logic which auto-labels columns in a subquery (for the purposes of sqlite compat) breaks the code, - # since it is creating "labels" on the fly but not affecting derived columns, which think they are - # still "physical" - q = table1.select(table1.c.this_is_the_primarykey_column == 4).alias('foo') - x = select([q]) - print x.execute().fetchall() - + # this is the test that fails if the "max identifier length" is + # shorter than the length of the actual columns created, because the + # column names get truncated. if you try to separate "physical + # columns" from "labels", and only truncate the labels, the + # compiler.DefaultCompiler.visit_select() logic which auto-labels + # columns in a subquery (for the purposes of sqlite compat) breaks the + # code, since it is creating "labels" on the fly but not affecting + # derived columns, which think they are still "physical" + q = table1.select(table1.c.this_is_the_primarykey_column == 4).alias('foo') + x = select([q]) + print x.execute().fetchall() + + @testing.requires.subqueries def test_anon_alias(self): - compile_dialect = default.DefaultDialect() - compile_dialect.max_identifier_length = IDENT_LENGTH + compile_dialect = default.DefaultDialect() + compile_dialect.max_identifier_length = IDENT_LENGTH - q = table1.select(table1.c.this_is_the_primarykey_column == 4).alias() - x = select([q], use_labels=True) + q = table1.select(table1.c.this_is_the_primarykey_column == 4).alias() + x = select([q], use_labels=True) - self.assert_compile(x, "SELECT anon_1.this_is_the_primarykey_column AS anon_1_this_is_the_prim_1, anon_1.this_is_the_data_column AS anon_1_this_is_the_data_2 " + self.assert_compile(x, "SELECT anon_1.this_is_the_primarykey_column AS anon_1_this_is_the_prim_1, anon_1.this_is_the_data_column AS anon_1_this_is_the_data_2 " "FROM (SELECT some_large_named_table.this_is_the_primarykey_column AS this_is_the_primarykey_column, some_large_named_table.this_is_the_data_column AS this_is_the_data_column " "FROM some_large_named_table " "WHERE some_large_named_table.this_is_the_primarykey_column = :this_is_the_primarykey__1) AS anon_1", dialect=compile_dialect) - print x.execute().fetchall() + print x.execute().fetchall() def test_oid(self): """test that a primary key column compiled as the 'oid' column gets proper length truncation""" |
