summaryrefslogtreecommitdiff
path: root/test/ext/mypy/plain_files/session.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2023-01-19 15:34:46 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2023-01-20 09:13:58 -0500
commitd1eeef5e67fa4632f88a894f0c5cf4445f04ba2b (patch)
tree30f2ad05dbf45bb2aa5dc33502a24cbdc5281097 /test/ext/mypy/plain_files/session.py
parente82a5f19e1606500ad4bf6a456c2558d74df24bf (diff)
downloadsqlalchemy-d1eeef5e67fa4632f88a894f0c5cf4445f04ba2b.tar.gz
typing updates
The :meth:`_sql.ColumnOperators.in_` and :meth:`_sql.ColumnOperators.not_in_` are typed to include ``Iterable[Any]`` rather than ``Sequence[Any]`` for more flexibility in argument type. The :func:`_sql.or_` and :func:`_sql.and_` from a typing perspective require the first argument to be present, however these functions still accept zero arguments which will emit a deprecation warning at runtime. Typing is also added to support sending the fixed literal ``False`` for :func:`_sql.or_` and ``True`` for :func:`_sql.and_` as the first argument only, however the documentation now indicates sending the :func:`_sql.false` and :func:`_sql.true` constructs in these cases as a more explicit approach. Fixed typing issue where iterating over a :class:`_orm.Query` object was not correctly typed. Fixes: #9122 Fixes: #9123 Fixes: #9125 Change-Id: I500e3e1b826717b3dd49afa1e682c3c8279c9226
Diffstat (limited to 'test/ext/mypy/plain_files/session.py')
-rw-r--r--test/ext/mypy/plain_files/session.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ext/mypy/plain_files/session.py b/test/ext/mypy/plain_files/session.py
index 49f1b44cb..636e3854a 100644
--- a/test/ext/mypy/plain_files/session.py
+++ b/test/ext/mypy/plain_files/session.py
@@ -77,4 +77,16 @@ with Session(e) as sess:
)
sess.query(User).update({"name": User.name + " some name"})
+ # test #9125
+
+ for row in sess.query(User.id, User.name):
+
+ # EXPECTED_TYPE: Row[Tuple[int, str]]
+ reveal_type(row)
+
+ for uobj1 in sess.query(User):
+
+ # EXPECTED_TYPE: User
+ reveal_type(uobj1)
+
# more result tests in typed_results.py