test_args.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:clickutil 作者: stroxler 项目源码 文件源码
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)'
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号