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


Python simple.Simple类代码示例

本文整理汇总了Python中examples.simple.Simple的典型用法代码示例。如果您正苦于以下问题:Python Simple类的具体用法?Python Simple怎么用?Python Simple使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Simple类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_non_callable_attributes

    def test_non_callable_attributes(self):
        view = Simple()
        view.thing = 'Chris'

        renderer = Renderer()
        actual = renderer.render(view)
        self.assertEqual(actual, "Hi Chris!")
开发者ID:GbalsaC,项目名称:bitnamiP,代码行数:7,代码来源:test_specloader.py

示例2: test_template_load_from_multiple_path

 def test_template_load_from_multiple_path(self):
     path = Simple.template_path
     Simple.template_path = ('examples/nowhere','examples',)
     try:
         view = Simple(thing='world')
         self.assertEquals(view.render(), "Hi world!")
     finally:
         Simple.template_path = path
开发者ID:holizz,项目名称:pystache,代码行数:8,代码来源:test_view.py

示例3: test_accessing_properties_on_parent_object_from_child_objects

 def test_accessing_properties_on_parent_object_from_child_objects(self):
     parent = Thing()
     parent.this = 'derp'
     parent.children = [Thing()]
     view = Simple(context={'parent': parent})
     view.template = "{{#parent}}{{#children}}{{this}}{{/children}}{{/parent}}"
     
     self.assertEquals(view.render(), 'derp')
开发者ID:holizz,项目名称:pystache,代码行数:8,代码来源:test_view.py

示例4: test_accessing_properties_on_parent_object_from_child_objects

    def test_accessing_properties_on_parent_object_from_child_objects(self):
        parent = Thing()
        parent.this = 'derp'
        parent.children = [Thing()]
        view = Simple()
        view.template = "{{#parent}}{{#children}}{{this}}{{/children}}{{/parent}}"

        renderer = Renderer()
        actual = renderer.render(view, {'parent': parent})

        self.assertString(actual, u'derp')
开发者ID:GbalsaC,项目名称:bitnamiP,代码行数:11,代码来源:test_specloader.py

示例5: test_render__partials

    def test_render__partials(self):
        """
        Test passing partials to View.__init__().

        """
        template = "{{>partial}}"
        partials = {"partial": "Loaded from dictionary"}
        view = Simple(template=template, partials=partials)
        actual = view.render()

        self.assertEquals(actual, "Loaded from dictionary")
开发者ID:jakearchibald,项目名称:pystache,代码行数:11,代码来源:test_view.py

示例6: test_basic

 def test_basic(self):
     view = Simple("Hi {{thing}}!", { 'thing': 'world' })
     self.assertEquals(view.render(), "Hi world!")
开发者ID:enaeseth,项目名称:pystache,代码行数:3,代码来源:test_view.py

示例7: test_view_instances_as_attributes

 def test_view_instances_as_attributes(self):
     other = Simple(name='chris')
     other.template = '{{name}}'
     view = Simple()
     view.thing = other
     self.assertEquals(view.render(), "Hi chris!")
开发者ID:enaeseth,项目名称:pystache,代码行数:6,代码来源:test_view.py

示例8: test_non_callable_attributes

 def test_non_callable_attributes(self):
     view = Simple()
     view.thing = 'Chris'
     self.assertEquals(view.render(), "Hi Chris!")
开发者ID:enaeseth,项目名称:pystache,代码行数:4,代码来源:test_view.py

示例9: test_basic_method_calls

 def test_basic_method_calls(self):
     view = Simple()
     self.assertEquals(view.render(), "Hi pizza!")
开发者ID:enaeseth,项目名称:pystache,代码行数:3,代码来源:test_view.py

示例10: test_template_load

 def test_template_load(self):
     view = Simple(thing='world')
     self.assertEquals(view.render(), "Hi world!")
开发者ID:enaeseth,项目名称:pystache,代码行数:3,代码来源:test_view.py

示例11: test_kwargs

 def test_kwargs(self):
     view = Simple("Hi {{thing}}!", thing='world')
     self.assertEquals(view.render(), "Hi world!")
开发者ID:enaeseth,项目名称:pystache,代码行数:3,代码来源:test_view.py

示例12: test_basic_sections

 def test_basic_sections(self):
     view = Simple("{{#x}}{{#x}}x{{/x}}{{/x}}", { 'x': [{'x':[1,2,3]},{'x':[4,5,6]}] })
     self.assertEquals(view.render(), "xxxxxx")
开发者ID:holizz,项目名称:pystache,代码行数:3,代码来源:test_view.py

示例13: test_context_returns_a_flattened_dict

    def test_context_returns_a_flattened_dict(self):
        view = Simple()
        view.context_list = [{'one':'1'}, {'two':'2'}, object()]

        self.assertEqual(view.context, {'one': '1', 'two': '2'})
开发者ID:holizz,项目名称:pystache,代码行数:5,代码来源:test_view.py

示例14: test_basic

 def test_basic(self):
     view = Simple("Hi {{thing}}!", {"thing": "world"})
     self.assertEquals(view.render(), "Hi world!")
开发者ID:nickretallack,项目名称:pystache,代码行数:3,代码来源:test_view.py

示例15: test_context_returns_a_flattened_dict

    def test_context_returns_a_flattened_dict(self):
        view = Simple()
        view.context_list = [{"one": "1"}, {"two": "2"}, object()]

        self.assertEqual(view.context, {"one": "1", "two": "2"})
开发者ID:nickretallack,项目名称:pystache,代码行数:5,代码来源:test_view.py


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