Add further typing tests
This should help ensure the app decorators are correctly typed.
This commit is contained in:
parent
9b44bf2818
commit
2f1d1d6256
1 changed files with 38 additions and 0 deletions
38
tests/typing/typing_app_decorators.py
Normal file
38
tests/typing/typing_app_decorators.py
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import typing as t
|
||||
|
||||
from flask import Flask
|
||||
from flask import Response
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
|
||||
@app.after_request
|
||||
def after_sync(response: Response) -> Response:
|
||||
...
|
||||
|
||||
|
||||
@app.after_request
|
||||
async def after_async(response: Response) -> Response:
|
||||
...
|
||||
|
||||
|
||||
@app.before_request
|
||||
def before_sync() -> None:
|
||||
...
|
||||
|
||||
|
||||
@app.before_request
|
||||
async def before_async() -> None:
|
||||
...
|
||||
|
||||
|
||||
@app.teardown_appcontext
|
||||
def teardown_sync(exc: t.Optional[BaseException]) -> None:
|
||||
...
|
||||
|
||||
|
||||
@app.teardown_appcontext
|
||||
async def teardown_async(exc: t.Optional[BaseException]) -> None:
|
||||
...
|
||||
Loading…
Add table
Add a link
Reference in a new issue