test_file_writer_decorator.py 文件源码

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

项目:fuzzinator 作者: renatahodovan 项目源码 文件源码
def test_file_writer_decorator(call, call_init_kwargs, call_kwargs, dec_kwargs, exp, tmpdir):
    tmp_dec_kwargs = dict(dec_kwargs)
    tmp_dec_kwargs['filename'] = os.path.join('%s' % tmpdir, dec_kwargs['filename'])

    call = fuzzinator.call.FileWriterDecorator(**tmp_dec_kwargs)(call)
    if inspect.isclass(call):
        call = call(**call_init_kwargs)

    out = call(**call_kwargs)

    if out is not None:
        assert re.fullmatch(pattern=dec_kwargs['filename'].format(uid='.*'), string=out['filename']) is not None
        assert out['test'] == os.path.join('%s' % tmpdir, out['filename'])
        assert not os.path.exists(out['test'])

        del out['filename']
        del out['test']

    assert out == exp
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号