summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing/suite/test_insert.py
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2020-05-01 23:19:32 +0000
committerGerrit Code Review <gerrit@bbpush.zzzcomputing.com>2020-05-01 23:19:32 +0000
commitea87d39d7a9926dc1c6bf3d70e8faf8575769cb0 (patch)
treeee11512a1dd3bcb48aa2f1234881bd3e04f51ed1 /lib/sqlalchemy/testing/suite/test_insert.py
parent31898e90618e946aca3eef2914b03e8534c464aa (diff)
parentaded39f68c29e44a50c85be1ddb370d3d1affe9d (diff)
downloadsqlalchemy-ea87d39d7a9926dc1c6bf3d70e8faf8575769cb0.tar.gz
Merge "Propose Result as immediate replacement for ResultProxy"
Diffstat (limited to 'lib/sqlalchemy/testing/suite/test_insert.py')
-rw-r--r--lib/sqlalchemy/testing/suite/test_insert.py24
1 files changed, 22 insertions, 2 deletions
diff --git a/lib/sqlalchemy/testing/suite/test_insert.py b/lib/sqlalchemy/testing/suite/test_insert.py
index f449b2fe6..92e38ab20 100644
--- a/lib/sqlalchemy/testing/suite/test_insert.py
+++ b/lib/sqlalchemy/testing/suite/test_insert.py
@@ -114,7 +114,13 @@ class InsertBehaviorTest(fixtures.TablesTest):
assert r._soft_closed
assert not r.closed
assert r.is_insert
- assert not r.returns_rows
+
+ # new as of I8091919d45421e3f53029b8660427f844fee0228; for the moment
+ # an insert where the PK was taken from a row that the dialect
+ # selected, as is the case for mssql/pyodbc, will still report
+ # returns_rows as true because there's a cursor description. in that
+ # case, the row had to have been consumed at least.
+ assert not r.returns_rows or r.fetchone() is None
@requirements.returning
def test_autoclose_on_insert_implicit_returning(self, connection):
@@ -124,7 +130,21 @@ class InsertBehaviorTest(fixtures.TablesTest):
assert r._soft_closed
assert not r.closed
assert r.is_insert
- assert not r.returns_rows
+
+ # note we are experimenting with having this be True
+ # as of I8091919d45421e3f53029b8660427f844fee0228 .
+ # implicit returning has fetched the row, but it still is a
+ # "returns rows"
+ assert r.returns_rows
+
+ # and we should be able to fetchone() on it, we just get no row
+ eq_(r.fetchone(), None)
+
+ # and the keys, etc.
+ eq_(r.keys(), ["id"])
+
+ # but the dialect took in the row already. not really sure
+ # what the best behavior is.
@requirements.empty_inserts
def test_empty_insert(self, connection):