summaryrefslogtreecommitdiff
path: root/test/sql
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2009-08-08 16:49:28 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2009-08-08 16:49:28 +0000
commita7499ddfc0c9c07830b08863918c21bf5e984997 (patch)
tree7c369fff36c04109a0f8b8fba2777fb689635287 /test/sql
parent491f6796f869d597922018660cc491441a878543 (diff)
downloadsqlalchemy-a7499ddfc0c9c07830b08863918c21bf5e984997.tar.gz
fix up oracle tests, returning is on by default
Diffstat (limited to 'test/sql')
-rw-r--r--test/sql/test_returning.py33
1 files changed, 31 insertions, 2 deletions
diff --git a/test/sql/test_returning.py b/test/sql/test_returning.py
index e076f3fe7..1b69c55ff 100644
--- a/test/sql/test_returning.py
+++ b/test/sql/test_returning.py
@@ -4,7 +4,6 @@ from sqlalchemy.test import *
from sqlalchemy.test.schema import Table, Column
from sqlalchemy.types import TypeDecorator
-
class ReturningTest(TestBase, AssertsExecutionResults):
__unsupported_on__ = ('sqlite', 'mysql', 'maxdb', 'sybase', 'access')
@@ -35,7 +34,7 @@ class ReturningTest(TestBase, AssertsExecutionResults):
def teardown(self):
table.drop()
-
+
@testing.exclude('firebird', '<', (2, 0), '2.0+ feature')
@testing.exclude('postgresql', '<', (8, 2), '8.3+ feature')
def test_column_targeting(self):
@@ -157,3 +156,33 @@ class SequenceReturningTest(TestBase):
r = table.insert().values(data='hi').returning(table.c.id).execute()
assert r.first() == (1, )
assert seq.execute() == 2
+
+class KeyReturningTest(TestBase, AssertsExecutionResults):
+ """test returning() works with columns that define 'key'."""
+
+ __unsupported_on__ = ('sqlite', 'mysql', 'maxdb', 'sybase', 'access')
+
+ def setup(self):
+ meta = MetaData(testing.db)
+ global table
+
+ table = Table('tables', meta,
+ Column('id', Integer, primary_key=True, key='foo_id', test_needs_autoincrement=True),
+ Column('data', String(20)),
+ )
+ table.create(checkfirst=True)
+
+ def teardown(self):
+ table.drop()
+
+ @testing.exclude('firebird', '<', (2, 0), '2.0+ feature')
+ @testing.exclude('postgresql', '<', (8, 2), '8.3+ feature')
+ def test_insert(self):
+ result = table.insert().returning(table.c.foo_id).execute(data='somedata')
+ row = result.first()
+ assert row[table.c.foo_id] == row['id'] == 1
+
+ result = table.select().execute().first()
+ assert row[table.c.foo_id] == row['id'] == 1
+
+