Skip to content
Myr

apply updated pre-commit hooks

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Lord · committed by David Lord · parent ff06d50 · Browse files · 5 files+14 added−20 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

5 files+14 added−20 removed

  • tests:+13 added−19 removed
  • other:+1 added−1 removed

5 files+14 added−20 removed

modified:src/click/globals.py+1 added-1 removed
34 unmodified lines
35 _local.stack.pop()363738def resolve_color_default(color=None):39 """"Internal helper to get the default value of the color flag. If a39 """Internal helper to get the default value of the color flag. If a40 value is passed it's returned unchanged, otherwise it's looked up from41 the current context.42 """43 if color is not None:
4 unmodified lines
modified:tests/test_formatting.py+9 added-13 removed
50 unmodified lines
5152def test_wrapping_long_options_strings(runner):53 @click.group()54 def cli():55 """Top level command56 """55 """Top level command"""5657 @cli.group()58 def a_very_long():60 """Second level61 """59 """Second level"""6061 @a_very_long.command()62 @click.argument("first")63 @click.argument("second")
1 unmodified line
65 @click.argument("fourth")66 @click.argument("fifth")67 @click.argument("sixth")68 def command():71 """A command.72 """69 """A command."""7071 # 54 is chosen as a length where the second line is one character72 # longer than the maximum length.73 result = runner.invoke(cli, ["a-very-long", "command", "--help"], terminal_width=54)
12 unmodified lines
8687def test_wrapping_long_command_name(runner):88 @click.group()89 def cli():93 """Top level command94 """90 """Top level command"""9192 @cli.group()93 def a_very_very_very_long():98 """Second level99 """94 """Second level"""9596 @a_very_very_very_long.command()97 @click.argument("first")98 @click.argument("second")
1 unmodified line
100 @click.argument("fourth")101 @click.argument("fifth")102 @click.argument("sixth")103 def command():109 """A command.110 """104 """A command."""105106 result = runner.invoke(107 cli, ["a-very-very-very-long", "command", "--help"], terminal_width=54108 )
12 unmodified lines
121122def test_formatting_empty_help_lines(runner):123 @click.command()124 def cli():125 # fmt: off126 """Top level command127128 """129 # fmt: on130131 result = runner.invoke(cli, ["--help"])132 assert not result.exception133 assert result.output.splitlines() == [
167 unmodified lines
301 @click.option("-f", "in_file", default="out.txt", help="Output file name")302 def cli():303 pass304309 result = runner.invoke(cli, ["--help"],)305 result = runner.invoke(cli, ["--help"])306 assert result.output.splitlines() == [307 "Usage: cli [OPTIONS]",308 "",309 "Options:",
45 unmodified lines
modified:tests/test_options.py+2 added-2 removed
486 unmodified lines
487 )488 def cmd(config):489 pass490491 result = runner.invoke(cmd, ["--help"],)491 result = runner.invoke(cmd, ["--help"])492 assert result.exit_code == 0493 i = " " * 21494 assert (495 " -C, --config PATH Configuration file to use.\n"
156 unmodified lines
652 """When a boolean flag only has one opt, it will show the default653 value, not the opt name.654 """655 opt = click.Option(656 ("--cache",), is_flag=True, show_default=True, help="Enable the cache.",656 ("--cache",), is_flag=True, show_default=True, help="Enable the cache."657 )658 ctx = click.Context(click.Command("test"))659 message = opt.get_help_record(ctx)[1]660 assert "[default: False]" in message
31 unmodified lines
modified:tests/test_shell_completion.py+1 added-3 removed
261 unmodified lines
262 "click.shell_completion.BashComplete._check_version", lambda self: True263 )264265266@pytest.mark.parametrize(267 "shell", ["bash", "zsh", "fish"],268)266@pytest.mark.parametrize("shell", ["bash", "zsh", "fish"])267@pytest.mark.usefixtures("_patch_for_completion")268def test_full_source(runner, shell):269 cli = Group("cli", commands=[Command("a"), Command("b")])270 result = runner.invoke(cli, env={"_CLI_COMPLETE": f"{shell}_source"})
44 unmodified lines
modified:tests/test_termui.py+1 added-1 removed
378 unmodified lines
379 assert click.getchar() == f"{special_key_char}{key_char}"380381382@pytest.mark.parametrize(383 ("key_char", "exc"), [("\x03", KeyboardInterrupt), ("\x1a", EOFError)],383 ("key_char", "exc"), [("\x03", KeyboardInterrupt), ("\x1a", EOFError)]384)385@pytest.mark.skipif(not WIN, reason="Tests user-input using the msvcrt module.")386def test_getchar_windows_exceptions(runner, monkeypatch, key_char, exc):387 monkeypatch.setattr(click._termui_impl.msvcrt, "getwch", lambda: key_char)
61 unmodified lines