本文整理汇总了Python中examples.lambdas.Lambdas类的典型用法代码示例。如果您正苦于以下问题:Python Lambdas类的具体用法?Python Lambdas怎么用?Python Lambdas使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Lambdas类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_higher_order_rot13
def test_higher_order_rot13(self):
view = Lambdas()
view.template = '{{#rot13}}abcdefghijklm{{/rot13}}'
renderer = Renderer()
actual = renderer.render(view)
self.assertString(actual, u'nopqrstuvwxyz')
示例2: test_partials_with_lambda
def test_partials_with_lambda(self):
view = Lambdas()
view.template = '{{>partial_with_lambda}}'
renderer = Renderer(search_dirs=EXAMPLES_DIR)
actual = renderer.render(view)
self.assertEqual(actual, u'nopqrstuvwxyz')
示例3: test_hierarchical_partials_with_lambdas
def test_hierarchical_partials_with_lambdas(self):
view = Lambdas()
view.template = '{{>partial_with_partial_and_lambda}}'
renderer = Renderer(search_dirs=EXAMPLES_DIR)
actual = renderer.render(view)
self.assertString(actual, u'nopqrstuvwxyznopqrstuvwxyz')
示例4: test_callables
def test_callables(self):
view = Lambdas()
view.template = '{{#replace_foo_with_bar}}foo != bar. oh, it does!{{/replace_foo_with_bar}}'
renderer = Renderer()
actual = renderer.render(view)
self.assertString(actual, u'bar != bar. oh, it does!')
示例5: test_higher_order_lambda
def test_higher_order_lambda(self):
view = Lambdas()
view.template = '{{#sort}}zyxwvutsrqponmlkjihgfedcba{{/sort}}'
renderer = Renderer()
actual = renderer.render(view)
self.assertString(actual, u'abcdefghijklmnopqrstuvwxyz')
示例6: test_hierarchical_partials_with_lambdas
def test_hierarchical_partials_with_lambdas(self):
view = Lambdas()
view.template = '{{>partial_with_partial_and_lambda}}'
self.assertEquals(view.render(), 'nopqrstuvwxyznopqrstuvwxyz')
示例7: test_higher_order_lambda
def test_higher_order_lambda(self):
view = Lambdas()
view.template = '{{#sort}}zyxwvutsrqponmlkjihgfedcba{{/sort}}'
self.assertEquals(view.render(), 'abcdefghijklmnopqrstuvwxyz')
示例8: test_higher_order_rot13
def test_higher_order_rot13(self):
view = Lambdas()
view.template = '{{#rot13}}abcdefghijklm{{/rot13}}'
self.assertEquals(view.render(), 'nopqrstuvwxyz')
示例9: test_higher_order_replace
def test_higher_order_replace(self):
view = Lambdas()
self.assertEquals(view.render(),
'bar != bar. oh, it does!')
示例10: test_partials_with_lambda
def test_partials_with_lambda(self):
view = Lambdas()
view.template = "{{>partial_with_lambda}}"
self.assertEquals(view.render(), "nopqrstuvwxyz")