From fa812e3f267f157f254ca7bafebca200d4fa3159 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 2 Mar 2024 16:54:37 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/click/__init__.py | 2 +- src/click/parser.py | 2 +- tests/test_commands.py | 23 ++++++++++++++++------- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/click/__init__.py b/src/click/__init__.py index fb43bb7ef..ff0ec8624 100644 --- a/src/click/__init__.py +++ b/src/click/__init__.py @@ -54,6 +54,7 @@ from .types import File as File from .types import FLOAT as FLOAT from .types import FloatRange as FloatRange +from .types import FORWARD as FORWARD from .types import INT as INT from .types import IntRange as IntRange from .types import ParamType as ParamType @@ -61,7 +62,6 @@ from .types import STRING as STRING from .types import Tuple as Tuple from .types import UNPROCESSED as UNPROCESSED -from .types import FORWARD as FORWARD from .types import UUID as UUID from .utils import echo as echo from .utils import format_filename as format_filename diff --git a/src/click/parser.py b/src/click/parser.py index decc6af48..db0f9ae1c 100644 --- a/src/click/parser.py +++ b/src/click/parser.py @@ -329,7 +329,7 @@ def _stop_process_args_for_options(self, state: _ParsingState) -> bool: return True if not largs: break - largs = largs[args.nargs:] + largs = largs[args.nargs :] return False def _process_args_for_options(self, state: _ParsingState) -> None: diff --git a/tests/test_commands.py b/tests/test_commands.py index bf642f3b0..669ca0acd 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -332,7 +332,7 @@ def cmd(f, files): args = ["echo", "-foo", "bar", "-f", "-h", "--help"] result = runner.invoke(cmd, args) - assert result.output.splitlines() == [''] + args + assert result.output.splitlines() == [""] + args def test_forward_options_group(runner): @@ -351,12 +351,21 @@ def cp(a, src, dsts): for dst in dsts: click.echo(dst) - - result = runner.invoke(cmd, ["-f", "f", "cp", "-a", "a", "src", "dst1", - "-a", "dst2", "-h", "--help", "-f"]) - assert result.output.splitlines() == ["f", "a", "src", "dst1", "-a", "dst2", - "-h", "--help", "-f"] - + result = runner.invoke( + cmd, + ["-f", "f", "cp", "-a", "a", "src", "dst1", "-a", "dst2", "-h", "--help", "-f"], + ) + assert result.output.splitlines() == [ + "f", + "a", + "src", + "dst1", + "-a", + "dst2", + "-h", + "--help", + "-f", + ] @pytest.mark.parametrize("doc", ["CLI HELP", None])