test_normalization.py
This file
Path
tests/test_normalization.py
38 lines · 955 bytes · Python
Last changed by
use ruff lint and format (#2658)David Lordbefore adoption1a3baf7
History of this fileTake it
The walk stopped after 200 commits: lines older than d334d82 point at it.
Merge pull request #1832 from pallets/option-help-spaceDavid Lordbefore adoptiond334d82
lines 1–38why, one step back1import click23CONTEXT_SETTINGS = dict(token_normalize_func=lambda x: x.lower())456def test_option_normalization(runner):7 @click.command(context_settings=CONTEXT_SETTINGS)8 @click.option("--foo")9 @click.option("-x")10 def cli(foo, x):11 click.echo(foo)12 click.echo(x)1314 result = runner.invoke(cli, ["--FOO", "42", "-X", 23])15 assert result.output == "42\n23\n"161718def test_choice_normalization(runner):19 @click.command(context_settings=CONTEXT_SETTINGS)20 @click.option("--choice", type=click.Choice(["Foo", "Bar"]))21 def cli(choice):22 click.echo(choice)2324 result = runner.invoke(cli, ["--CHOICE", "FOO"])25 assert result.output == "Foo\n"262728def test_command_normalization(runner):29 @click.group(context_settings=CONTEXT_SETTINGS)30 def cli():31 pass3233 @cli.command()34 def foo():35 click.echo("here!")3637 result = runner.invoke(cli, ["FOO"])38 assert result.output == "here!\n"