test_options.py 文件源码

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

项目:flake8-polyfill 作者: PyCQA 项目源码 文件源码
def test_generate_callback_from_composition(
        comma_separated_list, normalize_paths, preexisting_callback, values,
        parsed_value, expected_value,
):
    """Verify our generate_callback_from composition."""
    dest = 'foo'
    opt_str = '--{}'.format(dest)
    option = optparse.Option(opt_str, dest=dest)
    parser = mock.Mock(values=optparse.Values(values))

    callback = options.generate_callback_from(
        comma_separated_list=comma_separated_list,
        normalize_paths=normalize_paths,
        preexisting_callback=preexisting_callback,
    )

    callback(option, opt_str, parsed_value, parser)
    assert getattr(parser.values, dest) == expected_value
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号