test_normalization.py
This file
Path
tests/test_normalization.py
39 lines · 956 bytes · Python
Last changed by
apply blackDavid Lordbefore adoption93ba3ba
History of this fileTake it
The walk stopped after 200 commits: lines older than 950463b point at it.
Fix typo (#817)scottbeldenbefore adoption950463b
lines 1–8why, one step back1import click234CONTEXT_SETTINGS = dict(token_normalize_func=lambda x: x.lower())567def test_option_normalization(runner):8 @click.command(context_settings=CONTEXT_SETTINGS)apply blackDavid Lordbefore adoption93ba3ba
lines 9–10why, one step back9 @click.option("--foo")10 @click.option("-x")Fix typo (#817)scottbeldenbefore adoption950463b
lines 11–14why, one step back11 def cli(foo, x):12 click.echo(foo)13 click.echo(x)14apply blackDavid Lordbefore adoption93ba3ba
lines 15–16why, one step back15 result = runner.invoke(cli, ["--FOO", "42", "-X", 23])16 assert result.output == "42\n23\n"Fix typo (#817)scottbeldenbefore adoption950463b
lines 17–20why, one step back171819def test_choice_normalization(runner):20 @click.command(context_settings=CONTEXT_SETTINGS)apply blackDavid Lordbefore adoption93ba3ba
line 21why, one step back21 @click.option("--choice", type=click.Choice(["Foo", "Bar"]))Fix typo (#817)scottbeldenbefore adoption950463b
line 22why, one step back22 def cli(choice):Merge pull request #1318 from altendky/1277-altendky-return_exact_from_choice_insensitiveStephen Rosenbefore adoption1a714b3
line 23why, one step back23 click.echo(choice)Fix typo (#817)scottbeldenbefore adoption950463b
line 24why, one step back24apply blackDavid Lordbefore adoption93ba3ba
lines 25–26why, one step back25 result = runner.invoke(cli, ["--CHOICE", "FOO"])26 assert result.output == "Foo\n"Fix typo (#817)scottbeldenbefore adoption950463b
lines 27–35why, one step back272829def test_command_normalization(runner):30 @click.group(context_settings=CONTEXT_SETTINGS)31 def cli():32 pass3334 @cli.command()35 def foo():apply blackDavid Lordbefore adoption93ba3ba
line 36why, one step back36 click.echo("here!")Fix typo (#817)scottbeldenbefore adoption950463b
line 37why, one step back37apply blackDavid Lordbefore adoption93ba3ba
lines 38–39why, one step back38 result = runner.invoke(cli, ["FOO"])39 assert result.output == "here!\n"