当前位置: 首页>>代码示例>>Python>>正文


Python Renderer.missing_tags方法代码示例

本文整理汇总了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)
开发者ID:Abixer,项目名称:croomcroom,代码行数:12,代码来源:test_renderer.py

示例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")
开发者ID:Abixer,项目名称:croomcroom,代码行数:15,代码来源:test_renderer.py

示例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')
开发者ID:Abixer,项目名称:croomcroom,代码行数:17,代码来源:test_renderer.py

示例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")
开发者ID:Abixer,项目名称:croomcroom,代码行数:18,代码来源:test_renderer.py


注:本文中的pystache.Renderer.missing_tags方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。