From 07496da9b5272451fa85b02871369b3f3ba8bcca Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 16 May 2008 22:10:04 +0000 Subject: - added some help for a heavily flush-order-dependent test - quote flag propagates to _Label, [ticket:1045] --- test/sql/quote.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'test/sql/quote.py') 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() -- cgit v1.2.1