test_templates.py 文件源码

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

项目:jenskipper 作者: Stupeflix 项目源码 文件源码
def test_extract_jinja_error_with_fnames_prefix(data_dir):
    tpl_name = 'template.txt'
    try:
        templates.render(unicode(data_dir), tpl_name, {})
    except jinja2.UndefinedError:
        stack, error = templates.extract_jinja_error(sys.exc_info(),
                                                     unicode(data_dir))
    assert stack == [
        '  File "template.txt", line 1',
        '    My name is {{ name }}',
    ]
    assert error == "Undefined variable: 'name' is undefined"
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号