本文整理汇总了Python中pystache.Renderer.missing_tags方法的典型用法代码示例。如果您正苦于以下问题:Python Renderer.missing_tags方法的具体用法?Python Renderer.missing_tags怎么用?Python Renderer.missing_tags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pystache.Renderer
的用法示例。
在下文中一共展示了Renderer.missing_tags方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test__missing_tags__unknown_value
# 需要导入模块: from pystache import Renderer [as 别名]
# 或者: from pystache.Renderer import missing_tags [as 别名]
def test__missing_tags__unknown_value(self):
"""
Check missing_tags attribute: setting an unknown value.
"""
renderer = Renderer()
renderer.missing_tags = 'foo'
self.assertException(Exception, "Unsupported 'missing_tags' value: 'foo'",
renderer._make_render_engine)
示例2: test__resolve_partial__not_found__missing_tags_strict
# 需要导入模块: from pystache import Renderer [as 别名]
# 或者: from pystache.Renderer import missing_tags [as 别名]
def test__resolve_partial__not_found__missing_tags_strict(self):
"""
Check that resolve_partial provides a nice message when a template is not found.
"""
renderer = Renderer()
renderer.missing_tags = 'strict'
engine = renderer._make_render_engine()
resolve_partial = engine.resolve_partial
self.assertException(TemplateNotFoundError, "File 'foo.mustache' not found in dirs: ['.']",
resolve_partial, "foo")
示例3: test__resolve_context__missing_tags_strict
# 需要导入模块: from pystache import Renderer [as 别名]
# 或者: from pystache.Renderer import missing_tags [as 别名]
def test__resolve_context__missing_tags_strict(self):
"""
Check resolve_context(): missing_tags 'strict'.
"""
renderer = Renderer()
renderer.missing_tags = 'strict'
engine = renderer._make_render_engine()
stack = ContextStack({'foo': 'bar'})
self.assertEqual('bar', engine.resolve_context(stack, 'foo'))
self.assertException(KeyNotFoundError, "Key 'missing' not found: first part",
engine.resolve_context, stack, 'missing')
示例4: test__resolve_partial__not_found__partials_dict__missing_tags_strict
# 需要导入模块: from pystache import Renderer [as 别名]
# 或者: from pystache.Renderer import missing_tags [as 别名]
def test__resolve_partial__not_found__partials_dict__missing_tags_strict(self):
"""
Check that resolve_partial provides a nice message when a template is not found.
"""
renderer = Renderer()
renderer.missing_tags = 'strict'
renderer.partials = {}
engine = renderer._make_render_engine()
resolve_partial = engine.resolve_partial
# Include dict directly since str(dict) is different in Python 2 and 3:
# <type 'dict'> versus <class 'dict'>, respectively.
self.assertException(TemplateNotFoundError, "Name 'foo' not found in partials: %s" % dict,
resolve_partial, "foo")