def __repr__(self):
return repr(sql_util._repr_row(self))
- @util.deprecated(
- "1.4",
- "The :meth:`.Row.keys` method is deprecated and will be removed in a "
- "future release. Use the namedtuple standard accessor "
+ @util.deprecated_20(
+ ":meth:`.Row.keys`",
+ alternative="Use the namedtuple standard accessor "
":attr:`.Row._fields`, or for full mapping behavior use "
"row._mapping.keys() ",
)
text("select * from users where user_id=2")
).first()
- with testing.expect_deprecated(
- r"The Row.keys\(\) method is deprecated and will be "
- "removed in a future release."
+ with testing.expect_deprecated_20(
+ r"The Row.keys\(\) function/method is considered legacy "
):
eq_(r.keys(), ["user_id", "user_name"])
eq_(list(row._mapping.keys()), ["user_id", "user_name"])
eq_(row._fields, ("user_id", "user_name"))
+ def test_row_keys_legacy_dont_warn(self):
+ users = self.tables.users
+
+ users.insert().execute(user_id=1, user_name="foo")
+ result = users.select().execute()
+ row = result.first()
+ # DO NOT WARN DEPRECATED IN 1.x, ONLY 2.0 WARNING
+ eq_(dict(row), {"user_id": 1, "user_name": "foo"})
+ eq_(row.keys(), ["user_id", "user_name"])
+
def test_keys_anon_labels(self):
"""test [ticket:3483]"""