• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python mustache.build函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: __spec_test

 def __spec_test(self, test_suite):
     with open(self.PATH.format(test_suite), 'r') as fp:
         suite = json.loads(fp.read())
     tests = suite['tests']
     for test in tests:
         template = mustache.build(test['template'], test.get('partials'))
         result = mustache.render(template, test['data'])
         msg = '{}: {} != {}'.format(test['desc'], repr(str(test['expected'])), repr(str(result)))
         self.assertEqual(result, test['expected'], msg)
开发者ID:mylokin,项目名称:mustache,代码行数:9,代码来源:test_mustache.py


示例2: test_partials_4

 def test_partials_4(self):
     template = u'| {{>partial}} |'
     template = mustache.build(template, partials={u'partial': u'\t|\t'})
     context = {}
     rendered = mustache.render(template, context)
     self.assertEqual(rendered, u'| \t|\t |')
开发者ID:mylokin,项目名称:mustache,代码行数:6,代码来源:test_mustache.py


示例3: test_inverted_1

 def test_inverted_1(self):
     template = u'"{{^boolean}}This should not be rendered.{{/boolean}}"'
     template = mustache.build(template, partials=None)
     context = {u'boolean': True}
     rendered = mustache.render(template, context)
     self.assertEqual(rendered, u'""')
开发者ID:mylokin,项目名称:mustache,代码行数:6,代码来源:test_mustache.py


示例4: test_partials_9

 def test_partials_9(self):
     template = u'\\\n {{>partial}}\n/\n'
     template = mustache.build(template, partials={u'partial': u'|\n{{{content}}}\n|\n'})
     context = {u'content': u'<\n->'}
     rendered = mustache.render(template, context)
     self.assertEqual(rendered, u'\\\n |\n <\n->\n |\n/\n')
开发者ID:mylokin,项目名称:mustache,代码行数:6,代码来源:test_mustache.py


示例5: test_interpolation_29

 def test_interpolation_29(self):
     template = u'|{{& string }}|'
     template = mustache.build(template, partials=None)
     context = {u'string': u'---'}
     rendered = mustache.render(template, context)
     self.assertEqual(rendered, u'|---|')
开发者ID:mylokin,项目名称:mustache,代码行数:6,代码来源:test_mustache.py


示例6: test_partials_0

 def test_partials_0(self):
     template = u'"{{>text}}"'
     template = mustache.build(template, partials={u'text': u'from partial'})
     context = {}
     rendered = mustache.render(template, context)
     self.assertEqual(rendered, u'"from partial"')
开发者ID:mylokin,项目名称:mustache,代码行数:6,代码来源:test_mustache.py


示例7: test_interpolation_19

 def test_interpolation_19(self):
     template = u'"{{a.b.c.name}}" == ""'
     template = mustache.build(template, partials=None)
     context = {u'a': {u'b': {}}, u'c': {u'name': u'Jim'}}
     rendered = mustache.render(template, context)
     self.assertEqual(rendered, u'"" == ""')
开发者ID:mylokin,项目名称:mustache,代码行数:6,代码来源:test_mustache.py


示例8: test_interpolation_16

 def test_interpolation_16(self):
     template = u'"{{&person.name}}" == "{{#person}}{{&name}}{{/person}}"'
     template = mustache.build(template, partials=None)
     context = {u'person': {u'name': u'Joe'}}
     rendered = mustache.render(template, context)
     self.assertEqual(rendered, u'"Joe" == "Joe"')
开发者ID:mylokin,项目名称:mustache,代码行数:6,代码来源:test_mustache.py


示例9: test_comments_4

 def test_comments_4(self):
     template = u'|\r\n{{! Standalone Comment }}\r\n|'
     template = mustache.build(template, partials=None)
     context = {}
     rendered = mustache.render(template, context)
     self.assertEqual(rendered, u'|\r\n|')
开发者ID:mylokin,项目名称:mustache,代码行数:6,代码来源:test_mustache.py


示例10: test_comments_3

 def test_comments_3(self):
     template = u'Begin.\n  {{! Indented Comment Block! }}\nEnd.\n'
     template = mustache.build(template, partials=None)
     context = {}
     rendered = mustache.render(template, context)
     self.assertEqual(rendered, u'Begin.\nEnd.\n')
开发者ID:mylokin,项目名称:mustache,代码行数:6,代码来源:test_mustache.py


示例11: test_partials_5

 def test_partials_5(self):
     template = u'  {{data}}  {{> partial}}\n'
     template = mustache.build(template, partials={u'partial': u'>\n>'})
     context = {u'data': u'|'}
     rendered = mustache.render(template, context)
     self.assertEqual(rendered, u'  |  >\n>\n')
开发者ID:mylokin,项目名称:mustache,代码行数:6,代码来源:test_mustache.py


示例12: test_comments_1

 def test_comments_1(self):
     template = u'12345{{!\n  This is a\n  multi-line comment...\n}}67890\n'
     template = mustache.build(template, partials=None)
     context = {}
     rendered = mustache.render(template, context)
     self.assertEqual(rendered, u'1234567890\n')
开发者ID:mylokin,项目名称:mustache,代码行数:6,代码来源:test_mustache.py


示例13: test_sections_21

 def test_sections_21(self):
     template = u'|{{# boolean }}={{/ boolean }}|'
     template = mustache.build(template, partials=None)
     context = {u'boolean': True}
     rendered = mustache.render(template, context)
     self.assertEqual(rendered, u'|=|')
开发者ID:mylokin,项目名称:mustache,代码行数:6,代码来源:test_mustache.py


示例14: test_sections_20

 def test_sections_20(self):
     template = u'#{{#boolean}}\n/\n  {{/boolean}}'
     template = mustache.build(template, partials=None)
     context = {u'boolean': True}
     rendered = mustache.render(template, context)
     self.assertEqual(rendered, u'#\n/\n')
开发者ID:mylokin,项目名称:mustache,代码行数:6,代码来源:test_mustache.py


示例15: test_sections_17

 def test_sections_17(self):
     template = u'| This Is\n  {{#boolean}}\n|\n  {{/boolean}}\n| A Line\n'
     template = mustache.build(template, partials=None)
     context = {u'boolean': True}
     rendered = mustache.render(template, context)
     self.assertEqual(rendered, u'| This Is\n|\n| A Line\n')
开发者ID:mylokin,项目名称:mustache,代码行数:6,代码来源:test_mustache.py


示例16: test_interpolation_10

 def test_interpolation_10(self):
     template = u'"{{&power}} jiggawatts!"'
     template = mustache.build(template, partials=None)
     context = {u'power': 1.21}
     rendered = mustache.render(template, context)
     self.assertEqual(rendered, u'"1.21 jiggawatts!"')
开发者ID:mylokin,项目名称:mustache,代码行数:6,代码来源:test_mustache.py


示例17: test_interpolation_13

 def test_interpolation_13(self):
     template = u'I ({{&cannot}}) be seen!'
     template = mustache.build(template, partials=None)
     context = {}
     rendered = mustache.render(template, context)
     self.assertEqual(rendered, u'I () be seen!')
开发者ID:mylokin,项目名称:mustache,代码行数:6,代码来源:test_mustache.py


示例18: test_comments_6

 def test_comments_6(self):
     template = u"Begin.\n  {{!\n    Something's going on here...\n  }}\nEnd.\n"
     template = mustache.build(template, partials=None)
     context = {}
     rendered = mustache.render(template, context)
     self.assertEqual(rendered, u'Begin.\nEnd.\n')
开发者ID:mylokin,项目名称:mustache,代码行数:6,代码来源:test_mustache.py


示例19: test_interpolation_18

 def test_interpolation_18(self):
     template = u'"{{a.b.c}}" == ""'
     template = mustache.build(template, partials=None)
     context = {u'a': {}}
     rendered = mustache.render(template, context)
     self.assertEqual(rendered, u'"" == ""')
开发者ID:mylokin,项目名称:mustache,代码行数:6,代码来源:test_mustache.py


示例20: test_comments_7

 def test_comments_7(self):
     template = u'  12 {{! 34 }}\n'
     template = mustache.build(template, partials=None)
     context = {}
     rendered = mustache.render(template, context)
     self.assertEqual(rendered, u'  12 \n')
开发者ID:mylokin,项目名称:mustache,代码行数:6,代码来源:test_mustache.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python mustache.render函数代码示例发布时间:2022-05-27
下一篇:
Python locks.authority_of函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap