From 2f1d1d625697b9eca82dc8b2f46fff24dace63b1 Mon Sep 17 00:00:00 2001 From: pgjones Date: Fri, 8 Jul 2022 14:33:20 +0100 Subject: [PATCH] Add further typing tests This should help ensure the app decorators are correctly typed. --- tests/typing/typing_app_decorators.py | 38 +++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tests/typing/typing_app_decorators.py diff --git a/tests/typing/typing_app_decorators.py b/tests/typing/typing_app_decorators.py new file mode 100644 index 00000000..3df3e716 --- /dev/null +++ b/tests/typing/typing_app_decorators.py @@ -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: + ...