/
githubmirror
/
nbs
Обзор
Документация
Войти
/
githubmirror
/
nbs
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
contrib/python/click/py2/tests/test_normalization.py
39 строк
956 B
arigachnyy
add cloud/blockstore to oss
17 ноя 2023, 23:51
17 ноя 2023, 23:51
eafd563
Код
Авторство
О чём код?
import click CONTEXT_SETTINGS = dict(token_normalize_func=lambda x: x.lower()) def test_option_normalization(runner): @click.command(context_settings=CONTEXT_SETTINGS) @click.option("--foo") @click.option("-x") def cli(foo, x): click.echo(foo) click.echo(x) result = runner.invoke(cli, ["--FOO", "42", "-X", 23]) assert result.output == "42\n23\n" def test_choice_normalization(runner): @click.command(context_settings=CONTEXT_SETTINGS) @click.option("--choice", type=click.Choice(["Foo", "Bar"])) def cli(choice): click.echo(choice) result = runner.invoke(cli, ["--CHOICE", "FOO"]) assert result.output == "Foo\n" def test_command_normalization(runner): @click.group(context_settings=CONTEXT_SETTINGS) def cli(): pass @cli.command() def foo(): click.echo("here!") result = runner.invoke(cli, ["FOO"]) assert result.output == "here!\n"