diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-10-04 10:28:21 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-10-04 10:28:21 -0400 |
commit | f4ba5b856e470a0d9d89432859413b32cbc766d5 (patch) | |
tree | 2fb75db24c826cfbf5228df11acf31dfa32384ac /lib/sqlalchemy/testing/suite/test_insert.py | |
parent | 9ad570a39ab217b38c6afbabfa277f731da12f52 (diff) | |
download | sqlalchemy-f4ba5b856e470a0d9d89432859413b32cbc766d5.tar.gz |
- test updates
Diffstat (limited to 'lib/sqlalchemy/testing/suite/test_insert.py')
-rw-r--r-- | lib/sqlalchemy/testing/suite/test_insert.py | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/lib/sqlalchemy/testing/suite/test_insert.py b/lib/sqlalchemy/testing/suite/test_insert.py index 0a9896ffb..61b11966b 100644 --- a/lib/sqlalchemy/testing/suite/test_insert.py +++ b/lib/sqlalchemy/testing/suite/test_insert.py @@ -105,7 +105,32 @@ class InsertBehaviorTest(fixtures.TablesTest): assert r.is_insert assert not r.returns_rows +class ReturningTest(fixtures.TablesTest): + run_deletes = 'each' + __requires__ = 'returning', + + @classmethod + def define_tables(cls, metadata): + Table('autoinc_pk', metadata, + Column('id', Integer, primary_key=True, \ + test_needs_autoincrement=True), + Column('data', String(50)) + ) + + def test_explicit_returning_pk(self): + engine = config.db + table = self.tables.autoinc_pk + r = engine.execute( + table.insert().returning( + table.c.id), + data="some data" + ) + pk = r.first()[0] + fetched_pk = config.db.scalar(select([table.c.id])) + eq_(fetched_pk, pk) + + -__all__ = ('InsertSequencingTest', 'InsertBehaviorTest') +__all__ = ('InsertSequencingTest', 'InsertBehaviorTest', 'ReturningTest') |