summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2017-03-14 13:38:12 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2017-03-14 13:38:12 -0400
commit596e322543df6ff380243c9cb0cf9997252329f6 (patch)
treedd4d95cad90679e20f069fe63b8c143a237fb667 /test
parent2895c57b29c500fe4388ef23e61f13c5e1e9b4b2 (diff)
downloadsqlalchemy-596e322543df6ff380243c9cb0cf9997252329f6.tar.gz
Enable sane_multi_rowcount for cx_Oracle
Also add some tests to test_rowcount. Change-Id: Idaa18fdc4fcfeb615725531c37de77decf76a783 Fixes: #3932
Diffstat (limited to 'test')
-rw-r--r--test/sql/test_rowcount.py34
1 files changed, 31 insertions, 3 deletions
diff --git a/test/sql/test_rowcount.py b/test/sql/test_rowcount.py
index 0ab5589ab..16087b94c 100644
--- a/test/sql/test_rowcount.py
+++ b/test/sql/test_rowcount.py
@@ -57,14 +57,12 @@ class FoundRowsTest(fixtures.TestBase, AssertsExecutionResults):
# WHERE matches 3, 3 rows changed
department = employees_table.c.department
r = employees_table.update(department == 'C').execute(department='Z')
- print("expecting 3, dialect reports %s" % r.rowcount)
assert r.rowcount == 3
def test_update_rowcount2(self):
# WHERE matches 3, 0 rows changed
department = employees_table.c.department
r = employees_table.update(department == 'C').execute(department='C')
- print("expecting 3, dialect reports %s" % r.rowcount)
assert r.rowcount == 3
def test_raw_sql_rowcount(self):
@@ -87,5 +85,35 @@ class FoundRowsTest(fixtures.TestBase, AssertsExecutionResults):
# WHERE matches 3, 3 rows deleted
department = employees_table.c.department
r = employees_table.delete(department == 'C').execute()
- print("expecting 3, dialect reports %s" % r.rowcount)
assert r.rowcount == 3
+
+ @testing.requires.sane_multi_rowcount
+ def test_multi_update_rowcount(self):
+ stmt = employees_table.update().\
+ where(employees_table.c.name == bindparam('emp_name')).\
+ values(department="C")
+
+ r = testing.db.execute(
+ stmt,
+ [{"emp_name": "Bob"}, {"emp_name": "Cynthia"},
+ {"emp_name": "nonexistent"}]
+ )
+
+ eq_(
+ r.rowcount, 2
+ )
+
+ @testing.requires.sane_multi_rowcount
+ def test_multi_delete_rowcount(self):
+ stmt = employees_table.delete().\
+ where(employees_table.c.name == bindparam('emp_name'))
+
+ r = testing.db.execute(
+ stmt,
+ [{"emp_name": "Bob"}, {"emp_name": "Cynthia"},
+ {"emp_name": "nonexistent"}]
+ )
+
+ eq_(
+ r.rowcount, 2
+ )