def test_option_with_multiple_type_yes_default():
@click.command()
@option('--my-option', '-mo',
{'multiple': True, 'type': int}, "a click option")
def f(my_option=[2, 3]):
click.echo(repr(my_option))
runner = CliRunner()
# Check that it will run with default
result = runner.invoke(f, [])
assert result.exception is None
assert result.output.strip() == '(2, 3)'
# Check that it will run normally
result = runner.invoke(f, ['-mo', '3', '-mo', '4'])
assert result.exception is None
assert result.output.strip() == '(3, 4)'
评论列表
文章目录