Ejemplo n.º 1
0
    def test_template_partial_extension(self):
        view = TemplatePartial()
        view.template_extension = 'txt'
        assert_strings(self, view.render(), u"""Welcome
-------

## Again, Welcome! ##""")
Ejemplo n.º 2
0
    def test_delimiters(self):
        assert_strings(
            self,
            Delimiters().render(), """* It worked the first time.
* And it worked the second time.
* Then, surprisingly, it worked the third time.
""")
Ejemplo n.º 3
0
    def test_template_partial_extension(self):
        view = TemplatePartial()
        view.template_extension = 'txt'
        assert_strings(self, view.render(), u"""Welcome
-------

## Again, Welcome! ##""")
Ejemplo n.º 4
0
    def _assert_render(self, expected, template, *context, **kwargs):
        """
        Test rendering the given template using the given context.

        """
        partials = kwargs.get('partials')
        engine = kwargs.get('engine', self._engine())

        if partials is not None:
            engine.load_partial = lambda key: unicode(partials[key])

        context = Context(*context)

        actual = engine.render(template, context)

        assert_strings(test_case=self, actual=actual, expected=expected)
Ejemplo n.º 5
0
    def _assert_render(self, expected, template, *context, **kwargs):
        """
        Test rendering the given template using the given context.

        """
        partials = kwargs.get('partials')
        engine = kwargs.get('engine', self._engine())

        if partials is not None:
            engine.load_partial = lambda key: unicode(partials[key])

        context = Context(*context)

        actual = engine.render(template, context)

        assert_strings(test_case=self, actual=actual, expected=expected)
Ejemplo n.º 6
0
    def test_template_partial_extension(self):
        """
        Side note:

        From the spec--

            Partial tags SHOULD be treated as standalone when appropriate.

        In particular, this means that trailing newlines should be removed.

        """
        view = TemplatePartial()
        view.template_extension = 'txt'
        assert_strings(self, view.render(), u"""Welcome
-------

## Again, Welcome! ##""")
Ejemplo n.º 7
0
    def test_delimiters(self):
        assert_strings(self, Delimiters().render(), """* It worked the first time.
* And it worked the second time.
* Then, surprisingly, it worked the third time.
""")