本文整理汇总了Python中examples.simple.Simple.render方法的典型用法代码示例。如果您正苦于以下问题:Python Simple.render方法的具体用法?Python Simple.render怎么用?Python Simple.render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类examples.simple.Simple
的用法示例。
在下文中一共展示了Simple.render方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_accessing_properties_on_parent_object_from_child_objects
# 需要导入模块: from examples.simple import Simple [as 别名]
# 或者: from examples.simple.Simple import render [as 别名]
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')
示例2: test_template_load_from_multiple_path
# 需要导入模块: from examples.simple import Simple [as 别名]
# 或者: from examples.simple.Simple import render [as 别名]
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
示例3: test_render__partials
# 需要导入模块: from examples.simple import Simple [as 别名]
# 或者: from examples.simple.Simple import render [as 别名]
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")
示例4: test_basic
# 需要导入模块: from examples.simple import Simple [as 别名]
# 或者: from examples.simple.Simple import render [as 别名]
def test_basic(self):
view = Simple("Hi {{thing}}!", { 'thing': 'world' })
self.assertEquals(view.render(), "Hi world!")
示例5: test_view_instances_as_attributes
# 需要导入模块: from examples.simple import Simple [as 别名]
# 或者: from examples.simple.Simple import render [as 别名]
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!")
示例6: test_non_callable_attributes
# 需要导入模块: from examples.simple import Simple [as 别名]
# 或者: from examples.simple.Simple import render [as 别名]
def test_non_callable_attributes(self):
view = Simple()
view.thing = 'Chris'
self.assertEquals(view.render(), "Hi Chris!")
示例7: test_basic_method_calls
# 需要导入模块: from examples.simple import Simple [as 别名]
# 或者: from examples.simple.Simple import render [as 别名]
def test_basic_method_calls(self):
view = Simple()
self.assertEquals(view.render(), "Hi pizza!")
示例8: test_template_load
# 需要导入模块: from examples.simple import Simple [as 别名]
# 或者: from examples.simple.Simple import render [as 别名]
def test_template_load(self):
view = Simple(thing='world')
self.assertEquals(view.render(), "Hi world!")
示例9: test_kwargs
# 需要导入模块: from examples.simple import Simple [as 别名]
# 或者: from examples.simple.Simple import render [as 别名]
def test_kwargs(self):
view = Simple("Hi {{thing}}!", thing='world')
self.assertEquals(view.render(), "Hi world!")
示例10: test_basic_sections
# 需要导入模块: from examples.simple import Simple [as 别名]
# 或者: from examples.simple.Simple import render [as 别名]
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")
示例11: test_basic
# 需要导入模块: from examples.simple import Simple [as 别名]
# 或者: from examples.simple.Simple import render [as 别名]
def test_basic(self):
view = Simple("Hi {{thing}}!", {"thing": "world"})
self.assertEquals(view.render(), "Hi world!")