diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-05-16 22:10:04 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-05-16 22:10:04 +0000 |
commit | 07496da9b5272451fa85b02871369b3f3ba8bcca (patch) | |
tree | 54c622e1b624d2df9e74d7ea86893cb0496a5559 /test/sql/quote.py | |
parent | 2beb99a60ee8565079f5efdb11c92b3026b9b90e (diff) | |
download | sqlalchemy-07496da9b5272451fa85b02871369b3f3ba8bcca.tar.gz |
- added some help for a heavily flush-order-dependent test
- quote flag propagates to _Label, [ticket:1045]
Diffstat (limited to 'test/sql/quote.py')
-rw-r--r-- | test/sql/quote.py | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/test/sql/quote.py b/test/sql/quote.py index 6f474ba60..106189afe 100644 --- a/test/sql/quote.py +++ b/test/sql/quote.py @@ -80,10 +80,33 @@ class QuoteTest(TestBase, AssertsCompiledSQL): Column('col1', Integer, quote=True), quote=True, schema="foo", quote_schema=True) self.assert_compile(t1.select(), '''SELECT "foo"."t1"."col1" FROM "foo"."t1"''') + self.assert_compile(t1.select().apply_labels(), '''SELECT "foo"."t1"."col1" AS "foo_t1_col1" FROM "foo"."t1"''') + a = t1.select().alias('anon') + b = select([1], a.c.col1==2, from_obj=a) + self.assert_compile(b, + '''SELECT 1 FROM (SELECT "foo"."t1"."col1" AS "col1" FROM '''\ + '''"foo"."t1") AS anon WHERE anon."col1" = :col1_1''' + ) + metadata = MetaData() t1 = Table('TableOne', metadata, Column('ColumnOne', Integer, quote=False), quote=False, schema="FooBar", quote_schema=False) - self.assert_compile(t1.select(), '''SELECT FooBar.TableOne.ColumnOne FROM FooBar.TableOne''') + self.assert_compile(t1.select(), "SELECT FooBar.TableOne.ColumnOne FROM FooBar.TableOne") + + self.assert_compile(t1.select().apply_labels(), + "SELECT FooBar.TableOne.ColumnOne AS "\ + "FooBar_TableOne_ColumnOne FROM FooBar.TableOne" # TODO: is this what we really want here ? what if table/schema + # *are* quoted? + ) + + a = t1.select().alias('anon') + b = select([1], a.c.ColumnOne==2, from_obj=a) + self.assert_compile(b, + "SELECT 1 FROM (SELECT FooBar.TableOne.ColumnOne AS "\ + "ColumnOne FROM FooBar.TableOne) AS anon WHERE anon.ColumnOne = :ColumnOne_1" + ) + + def test_table_quote_flag(self): metadata = MetaData() |