Skip to content

Commit 8cd3efb

Browse files
committed
Get test to fail by using assert_type and mypy with 3.11
1 parent feec162 commit 8cd3efb

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

CHANGES.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
Version 3.0.4
2+
-------------
3+
4+
Unreleased
5+
6+
- Fix type hint for ``get_or_404`` return value. :pr:`1208`
7+
8+
19
Version 3.0.3
210
-------------
311

tests/test_view_query.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,10 @@ class Quiz(db.Model):
7373
item: Quiz = Quiz()
7474
db.session.add(item)
7575
db.session.commit()
76-
result: t.Optional[Quiz] = db.get_or_404(Quiz, 1)
76+
result = db.get_or_404(Quiz, 1)
7777
assert result is item
78+
if hasattr(t, "assert_type"):
79+
t.assert_type(result, Quiz)
7880
with pytest.raises(NotFound):
7981
assert db.get_or_404(Quiz, 2)
8082
db.drop_all()

tox.ini

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ wheel_build_env = .pkg
2929
constrain_package_deps = true
3030
use_frozen_constraints = true
3131
deps = -r requirements/mypy.txt
32-
commands = mypy
32+
commands =
33+
mypy --python-version 3.7
34+
mypy --python-version 3.11
3335

3436
[testenv:docs]
3537
package = wheel

0 commit comments

Comments
 (0)