summaryrefslogtreecommitdiff
path: root/test/sql/test_deprecations.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/sql/test_deprecations.py')
-rw-r--r--test/sql/test_deprecations.py26
1 files changed, 21 insertions, 5 deletions
diff --git a/test/sql/test_deprecations.py b/test/sql/test_deprecations.py
index 4af1f65e3..db2042f5b 100644
--- a/test/sql/test_deprecations.py
+++ b/test/sql/test_deprecations.py
@@ -1467,11 +1467,11 @@ class ConnectionlessCursorResultTest(fixtures.TablesTest):
"This result object does not return rows.",
result.fetchone,
)
- assert_raises_message(
- exc.ResourceClosedError,
- "This result object does not return rows.",
- result.keys,
- )
+
+ with testing.expect_deprecated_20(
+ r"Calling the .keys\(\) method on a result set that does not "
+ ):
+ eq_(result.keys(), [])
class CursorResultTest(fixtures.TablesTest):
@@ -1554,6 +1554,22 @@ class CursorResultTest(fixtures.TablesTest):
):
eq_(r._mapping[users.c.user_name], "jack")
+ def test_keys_no_rows(self, connection):
+
+ for i in range(2):
+ r = connection.execute(
+ text("update users set user_name='new' where user_id=10")
+ )
+
+ with testing.expect_deprecated(
+ r"Calling the .keys\(\) method on a result set that does not "
+ r"return rows is deprecated and will raise "
+ r"ResourceClosedError in SQLAlchemy 2.0."
+ ):
+ list_ = r.keys()
+ eq_(list_, [])
+ list_.append("Don't cache me")
+
def test_column_accessor_basic_text(self, connection):
users = self.tables.users