Skip to content
Myr

test_normalization.py

This file

Path

tests/test_normalization.py

39 lines · 956 bytes · Python

Last changed by

Not known.

History of this file

Take it

The walk stopped after 200 commits: lines older than 1b1578d point at it.

Merge pull request #1786 from MLH-Fellowship/custom-confirm-promptDavid Lordbefore adoption1b1578d

lines 1–39why, one step back
1import click
234CONTEXT_SETTINGS = dict(token_normalize_func=lambda x: x.lower())567def test_option_normalization(runner):8 @click.command(context_settings=CONTEXT_SETTINGS)9 @click.option("--foo")10 @click.option("-x")11 def cli(foo, x):12 click.echo(foo)13 click.echo(x)1415 result = runner.invoke(cli, ["--FOO", "42", "-X", 23])16 assert result.output == "42\n23\n"171819def test_choice_normalization(runner):20 @click.command(context_settings=CONTEXT_SETTINGS)21 @click.option("--choice", type=click.Choice(["Foo", "Bar"]))22 def cli(choice):23 click.echo(choice)2425 result = runner.invoke(cli, ["--CHOICE", "FOO"])26 assert result.output == "Foo\n"272829def test_command_normalization(runner):30 @click.group(context_settings=CONTEXT_SETTINGS)31 def cli():32 pass3334 @cli.command()35 def foo():36 click.echo("here!")3738 result = runner.invoke(cli, ["FOO"])39 assert result.output == "here!\n"