Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(5)  |  Call(4)  |  Derive(0)  |  Import(1)
Jinja2 template engine.

src/p/i/piecutter-0.1.1/piecutter/tests/engines/jinja.py   piecutter(Download)
# -*- coding: utf-8 -*-
"""Tests around piecutter.engines.jinja."""
import unittest
 
from piecutter.engines.jinja import Jinja2Engine
    def test_environment(self):
        """Jinja2Engine's environment contains additional functions."""
        engine = Jinja2Engine()
        environment = engine.environment
        self.assertTrue('path_join' in environment.globals)
        self.assertTrue('path_normalize' in environment.globals)
 
    def test_render_noop(self):
        """Jinja2Engine correctly renders ``Hello world!`` template."""
        engine = Jinja2Engine()
    def test_render_simple(self):
        """Jinja2Engine correctly renders ``Hello {{ name }}!`` template."""
        engine = Jinja2Engine()
        rendered = engine.render(u'Hello {{ name }}!', {'name': 'world'})
        self.assertEqual(rendered, u'Hello world!')
 
    def test_template_error(self):
        """Jinja2Engine raises TemplateError in case of exception."""
        engine = Jinja2Engine()