From aaafeaf82dedc2aee06dc9e333eeb2a86cbc167a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 6 Jul 2023 12:11:39 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20[pre-commit.ci]=20Auto=20format?= =?UTF-8?q?=20from=20pre-commit.com=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_annotated.py | 4 +++- typer/main.py | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/test_annotated.py b/tests/test_annotated.py index b4a3780386..5c6d91bc5d 100644 --- a/tests/test_annotated.py +++ b/tests/test_annotated.py @@ -58,8 +58,10 @@ def cmd(force: Annotated[bool, typer.Option("--force")] = False): assert result.exit_code == 0, result.output assert "Forcing operation" in result.output + def test_runner_can_use_an_async_method(): app = typer.Typer() + @app.command() async def cmd(val: Annotated[int, typer.Argument()] = 0): print(f"hello {val}") @@ -70,4 +72,4 @@ async def cmd(val: Annotated[int, typer.Argument()] = 0): result = runner.invoke(app, ["42"]) assert result.exit_code == 0, result.output - assert "hello 42" in result.output \ No newline at end of file + assert "hello 42" in result.output diff --git a/typer/main.py b/typer/main.py index 07174461da..ab4cd9a296 100644 --- a/typer/main.py +++ b/typer/main.py @@ -9,7 +9,7 @@ from pathlib import Path from traceback import FrameSummary, StackSummary from types import TracebackType -from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Type, Union, ParamSpec +from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Type, Union from uuid import UUID import click @@ -278,7 +278,6 @@ def runner(*args, **kwargs) -> Any: ) ) - return decorator def add_typer(