diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-02-05 16:58:32 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-02-05 16:58:32 -0500 |
commit | 2dbeeff50b7ccc6f47b2816a59f99f051fdabc8c (patch) | |
tree | c23ba02c34a7fec923bdddd99ff46b670e30bac2 /test/sql/test_quote.py | |
parent | 28765734826f2619fcfd40f047a5980c3af49010 (diff) | |
download | sqlalchemy-2dbeeff50b7ccc6f47b2816a59f99f051fdabc8c.tar.gz |
- [bug] Added support for using the .key
of a Column as a string identifier in a
result set row. The .key is currently
listed as an "alternate" name for a column,
and is superseded by the name of a column
which has that key value as its regular name.
For the next major release
of SQLAlchemy we may reverse this precedence
so that .key takes precedence, but this
is not decided on yet. [ticket:2392]
Diffstat (limited to 'test/sql/test_quote.py')
-rw-r--r-- | test/sql/test_quote.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/test/sql/test_quote.py b/test/sql/test_quote.py index c421a521f..952b14763 100644 --- a/test/sql/test_quote.py +++ b/test/sql/test_quote.py @@ -34,7 +34,7 @@ class QuoteTest(fixtures.TestBase, AssertsCompiledSQL): table1.drop() table2.drop() - def testbasic(self): + def test_basic(self): table1.insert().execute({'lowercase':1,'UPPERCASE':2,'MixedCase':3,'a123':4}, {'lowercase':2,'UPPERCASE':2,'MixedCase':3,'a123':4}, {'lowercase':4,'UPPERCASE':3,'MixedCase':2,'a123':1}) @@ -59,12 +59,12 @@ class QuoteTest(fixtures.TestBase, AssertsCompiledSQL): ')' ) - def testreflect(self): + def test_reflect(self): meta2 = MetaData(testing.db) t2 = Table('WorstCase2', meta2, autoload=True, quote=True) assert 'MixedCase' in t2.c - def testlabels(self): + def test_labels(self): table1.insert().execute({'lowercase':1,'UPPERCASE':2,'MixedCase':3,'a123':4}, {'lowercase':2,'UPPERCASE':2,'MixedCase':3,'a123':4}, {'lowercase':4,'UPPERCASE':3,'MixedCase':2,'a123':1}) @@ -136,7 +136,7 @@ class QuoteTest(fixtures.TestBase, AssertsCompiledSQL): @testing.crashes('oracle', 'FIXME: unknown, verify not fails_on') @testing.requires.subqueries - def testlabels(self): + def test_labels(self): """test the quoting of labels. if labels arent quoted, a query in postgresql in particular will fail since it produces: @@ -151,7 +151,7 @@ class QuoteTest(fixtures.TestBase, AssertsCompiledSQL): x = table1.select(distinct=True).alias("LaLa").select().scalar() - def testlabels2(self): + def test_labels2(self): metadata = MetaData() table = Table("ImATable", metadata, Column("col1", Integer)) @@ -174,14 +174,14 @@ class QuoteTest(fixtures.TestBase, AssertsCompiledSQL): metadata = MetaData() table = Table("ImATable", metadata, Column("col1", Integer), - Column("from", Integer, key="morf"), + Column("from", Integer), Column("louisville", Integer), Column("order", Integer)) - x = select([table.c.col1, table.c.morf, table.c.louisville, table.c.order]) + x = select([table.c.col1, table.c['from'], table.c.louisville, table.c.order]) self.assert_compile(x, '''SELECT "ImATable".col1, "ImATable"."from", "ImATable".louisville, "ImATable"."order" FROM "ImATable"''') - + class PreparerTest(fixtures.TestBase): """Test the db-agnostic quoting services of IdentifierPreparer.""" |