You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
diff --git a/test/sql/test_resultset.py b/test/sql/test_resultset.py
index e4f07a7580..3a7032f8b3 100644
--- a/test/sql/test_resultset.py+++ b/test/sql/test_resultset.py@@ -746,6 +746,47 @@ class CursorResultTest(fixtures.TablesTest):
eq_(r._mapping[users.c.user_name], "john")
eq_(r.user_name, "john")
+ def test_named_tuple_attribute_errors(self, connection):+ r = connection.execute(+ select(literal(1).label("a"), literal(2).label("b"))+ ).first()+ eq_(r.a, 1)+ eq_(r.b, 2)++ with expect_raises_message(+ AttributeError, "Could not locate column in row for column 'c'"+ ):+ r.c++ with expect_raises_message(AttributeError, "can't set attribute"):+ r.a = 5++ with expect_raises_message(AttributeError, "can't set attribute"):+ r.a += 5++ def test_mapping_tuple_readonly_errors(self, connection):+ r = connection.execute(+ select(literal(1).label("a"), literal(2).label("b"))+ ).first()+ r = r._mapping+ eq_(r["a"], 1)+ eq_(r["b"], 2)++ with expect_raises_message(+ KeyError, "Could not locate column in row for column 'c'"+ ):+ r["c"]++ with expect_raises_message(+ TypeError, "'RowMapping' object does not support item assignment"+ ):+ r["a"] = 5++ with expect_raises_message(+ TypeError, "'RowMapping' object does not support item assignment"+ ):+ r["a"] += 5+
def test_column_accessor_err(self, connection):
r = connection.execute(select(1)).first()
assert_raises_message(
Activity
zzzeek commentedon Dec 9, 2021
CaselIT commentedon Dec 9, 2021
I had already opened #7431
sqla-tester commentedon Dec 9, 2021
Mike Bayer has proposed a fix for this issue in the main branch:
implement correct errors for Row immutability https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/3360
sqla-tester commentedon Dec 9, 2021
Mike Bayer has proposed a fix for this issue in the rel_1_4 branch:
implement correct errors for Row immutability https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/3361
implement correct errors for Row immutability