diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-12-11 03:10:17 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-12-11 03:10:17 -0500 |
| commit | b88c54f95be3e3bc2e0923181d56862fa3fda9fa (patch) | |
| tree | eeb695bd9927895537d25a4402bad51b116c6964 /test/sql | |
| parent | 4fa0ea584248726b164008cb8e4257d207b03af9 (diff) | |
| parent | 9c0755640c5f1d45596ff7234d2d42f1c92d09e0 (diff) | |
| download | sqlalchemy-b88c54f95be3e3bc2e0923181d56862fa3fda9fa.tar.gz | |
do the mercurial dance (re-merge what I just merged...)
Diffstat (limited to 'test/sql')
| -rw-r--r-- | test/sql/test_query.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/test/sql/test_query.py b/test/sql/test_query.py index f59b34076..e14f5301e 100644 --- a/test/sql/test_query.py +++ b/test/sql/test_query.py @@ -654,7 +654,24 @@ class QueryTest(TestBase): getattr(result, meth), ) trans.rollback() - + + def test_no_inserted_pk_on_non_insert(self): + result = testing.db.execute("select * from query_users") + assert_raises_message( + exc.InvalidRequestError, + r"Statement is not an insert\(\) expression construct.", + getattr, result, 'inserted_primary_key' + ) + + @testing.requires.returning + def test_no_inserted_pk_on_returning(self): + result = testing.db.execute(users.insert().returning(users.c.user_id, users.c.user_name)) + assert_raises_message( + exc.InvalidRequestError, + r"Can't call inserted_primary_key when returning\(\) is used.", + getattr, result, 'inserted_primary_key' + ) + def test_fetchone_til_end(self): result = testing.db.execute("select * from query_users") eq_(result.fetchone(), None) |
