test_normalization.py
This file
Path
tests/test_normalization.py
39 lines · 955 bytes · Python
Last changed by
Not known.
History of this fileTake it
The walk stopped after 200 commits: lines older than bc9bb70 point at it.
Merge branch '6.x-maintenance'Markus Unterwaditzerbefore adoptionbc9bb70
lines 1–39why, 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)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('Foo')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'